mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
[raster] Guard arc angle math against zero-length vectors
This commit is contained in:
1 parent
16256caf0b
commit
8fa382dd67
1 file changed
+2
@@ -214,6 +214,8 @@ svg_arc_endpoint_to_center (float x1, float y1, float x2, float y2,
|
||||
auto angle = [] (float ux, float uy, float vx, float vy) -> float {
|
||||
float dot = ux * vx + uy * vy;
|
||||
float len = sqrtf ((ux * ux + uy * uy) * (vx * vx + vy * vy));
|
||||
if (!(len > 0.f) || !isfinite (len))
|
||||
return 0.f;
|
||||
float a = acosf (hb_clamp (dot / len, -1.f, 1.f));
|
||||
if (ux * vy - uy * vx < 0.f) a = -a;
|
||||
return a;
|
||||
|
||||
Reference in new issue
Block a user