LibGfx: VERIFY() error is finite when splitting bezier curves

If this value somehow becomes nan/inf the painter will keep splitting
the path till the process OOMs, a simple crash would be preferable.
This commit is contained in:
MacDue 2023-05-11 22:20:38 +01:00 committed by Andreas Kling
parent 1012947a30
commit 9070aaebee
Notes: sideshowbarker 2024-07-17 00:16:31 +09:00

View File

@ -2128,7 +2128,10 @@ static bool can_approximate_bezier_curve(FloatPoint p1, FloatPoint p2, FloatPoin
p2x = p2x * p2x;
p2y = p2y * p2y;
return max(p1x, p2x) + max(p1y, p2y) <= tolerance;
auto error = max(p1x, p2x) + max(p1y, p2y);
VERIFY(isfinite(error));
return error <= tolerance;
}
// static
@ -2202,7 +2205,10 @@ static bool can_approximate_cubic_bezier_curve(FloatPoint p1, FloatPoint p2, Flo
bx *= bx;
by *= by;
return max(ax, bx) + max(ay, by) <= tolerance;
auto error = max(ax, bx) + max(ay, by);
VERIFY(isfinite(error));
return error <= tolerance;
}
// static