mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 06:21:16 +01:00
Malformed COLRv1 gradients can report a non-zero stop count and then leave the effective stop array empty once allocations fail. The raster path assumed the second fetch always produced at least one stop and indexed stops[0], which let fuzzing hit a stack-buffer-underflow in evaluate_color_line(). Reject empty effective stop lists after the second fetch, handle zero-stop and one-stop evaluation defensively, and clamp non-finite gradient parameters before lookup. Apply the same stop-fetch hardening to the Cairo and vector paint helpers, including fixing Cairos wrong NULL check after hb_malloc(). Testing: not run (per user request) Fixes: https://oss-fuzz.com/testcase-detail/4635834988167168 Assisted-by: OpenAI Codex