RESOLVED FIXED 250384
Potential Assertion Fix - newStartAngle >= 0 && newStartAngle < twoPiFloat
https://bugs.webkit.org/show_bug.cgi?id=250384
Summary Potential Assertion Fix - newStartAngle >= 0 && newStartAngle < twoPiFloat
Ahmad Saleem
Reported 2023-01-10 07:07:11 PST
Hi Team, While going through Blink's commit, I came across following potential assertion fix: Blink Commit - https://chromium.googlesource.com/chromium/blink/+/651895c0233495405847471d42dab20deab2a0f3 WebKit Source - https://github.com/WebKit/WebKit/blob/28de25b653f64ca3fc8e87fbf1d1a963329a5342/Source/WebCore/html/canvas/CanvasPath.cpp#L143 Unfortunately, it does not have any test case to confirm whether it is an issue in Safari / WebKit or not but just wanted to get an input. Thanks!
Attachments
Radar WebKit Bug Importer
Comment 1 2023-01-17 07:08:16 PST
Ahmad Saleem
Comment 2 2023-10-27 15:00:01 PDT
This compiles: tatic void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise) { float newStartAngle = fmodf(startAngle, (2 * piFloat)); if (newStartAngle < 0) newStartAngle += (2 * piFloat);
Ahmad Saleem
Comment 3 2023-10-27 15:03:33 PDT
If we add this: constexpr auto twoPiFloat = 2 * piFloat; we can simplify whole function: static void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise) { constexpr auto twoPiFloat = 2 * piFloat; float newStartAngle = fmodf(startAngle, twoPiFloat); if (newStartAngle < 0) newStartAngle += twoPiFloat; float delta = newStartAngle - startAngle; startAngle = newStartAngle; endAngle = endAngle + delta; ASSERT(newStartAngle >= 0 && (newStartAngle < twoPiFloat || WTF::areEssentiallyEqual<float>(newStartAngle, twoPiFloat))); if (anticlockwise && startAngle - endAngle >= twoPiFloat) endAngle = startAngle - twoPiFloat; else if (!anticlockwise && endAngle - startAngle >= twoPiFloat) endAngle = startAngle + twoPiFloat; }
Ahmad Saleem
Comment 4 2023-10-29 06:33:57 PDT
EWS
Comment 5 2023-10-30 02:45:03 PDT
Committed 269925@main (34e0f2e73041): <https://commits.webkit.org/269925@main> Reviewed commits have been landed. Closing PR #19657 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.