LibWeb: Limit HTMLCanvasElement width and height to allowed values

Setting the `width` or `height` properties of `HTMLCanvasElement` to a
value greater than 2147483647 will now cause the property to be set to
its default value.
This commit is contained in:
Tim Ledbetter 2024-11-29 16:04:35 +00:00 committed by Tim Ledbetter
commit a486c86eee
Notes: github-actions[bot] 2024-12-01 15:12:58 +00:00
4 changed files with 73 additions and 10 deletions

View file

@ -11,6 +11,7 @@
#include <LibGfx/PaintingSurface.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/WebGL/WebGLRenderingContext.h>
#include <LibWeb/WebIDL/Types.h>
namespace Web::HTML {
@ -29,11 +30,11 @@ public:
JS::ThrowCompletionOr<RenderingContext> get_context(String const& type, JS::Value options);
unsigned width() const;
unsigned height() const;
WebIDL::UnsignedLong width() const;
WebIDL::UnsignedLong height() const;
WebIDL::ExceptionOr<void> set_width(unsigned);
WebIDL::ExceptionOr<void> set_height(unsigned);
WebIDL::ExceptionOr<void> set_width(WebIDL::UnsignedLong);
WebIDL::ExceptionOr<void> set_height(WebIDL::UnsignedLong);
String to_data_url(StringView type, JS::Value quality);
WebIDL::ExceptionOr<void> to_blob(GC::Ref<WebIDL::CallbackType> callback, StringView type, JS::Value quality);