From 8fa382dd67a6cf6e5e30ae27816d8790131d48ed Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 26 Feb 2026 01:29:50 -0300 Subject: [PATCH] [raster] Guard arc angle math against zero-length vectors --- src/hb-raster-svg-parse.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-raster-svg-parse.cc b/src/hb-raster-svg-parse.cc index 213aeb7bf..de8b5ceae 100644 --- a/src/hb-raster-svg-parse.cc +++ b/src/hb-raster-svg-parse.cc @@ -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;