mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Reject non-finite values in 2D canvas transforms
This commit is contained in:
parent
7032cb0235
commit
8540954bf8
Notes:
github-actions[bot]
2024-08-20 07:37:30 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/8540954bf89 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1024
2 changed files with 8 additions and 3 deletions
|
@ -24,7 +24,8 @@ public:
|
|||
void scale(float sx, float sy)
|
||||
{
|
||||
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasTransform::scale({}, {})", sx, sy);
|
||||
|
||||
if (!isfinite(sx) || !isfinite(sy))
|
||||
return;
|
||||
my_drawing_state().transform.scale(sx, sy);
|
||||
flush_transform();
|
||||
}
|
||||
|
@ -32,6 +33,8 @@ public:
|
|||
void translate(float tx, float ty)
|
||||
{
|
||||
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasTransform::translate({}, {})", tx, ty);
|
||||
if (!isfinite(tx) || !isfinite(ty))
|
||||
return;
|
||||
my_drawing_state().transform.translate(tx, ty);
|
||||
flush_transform();
|
||||
}
|
||||
|
@ -39,6 +42,8 @@ public:
|
|||
void rotate(float radians)
|
||||
{
|
||||
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasTransform::rotate({})", radians);
|
||||
if (!isfinite(radians))
|
||||
return;
|
||||
my_drawing_state().transform.rotate_radians(radians);
|
||||
flush_transform();
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ Gfx::Path CanvasRenderingContext2D::rect_path(float x, float y, float width, flo
|
|||
|
||||
void CanvasRenderingContext2D::fill_rect(float x, float y, float width, float height)
|
||||
{
|
||||
return fill_internal(rect_path(x, y, width, height), Gfx::WindingRule::EvenOdd);
|
||||
fill_internal(rect_path(x, y, width, height), Gfx::WindingRule::EvenOdd);
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::clear_rect(float x, float y, float width, float height)
|
||||
|
@ -312,7 +312,7 @@ void CanvasRenderingContext2D::fill_internal(Gfx::Path const& path, Gfx::Winding
|
|||
|
||||
void CanvasRenderingContext2D::fill(StringView fill_rule)
|
||||
{
|
||||
return fill_internal(path(), parse_fill_rule(fill_rule));
|
||||
fill_internal(path(), parse_fill_rule(fill_rule));
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::fill(Path2D& path, StringView fill_rule)
|
||||
|
|
Loading…
Reference in a new issue