Files
harfbuzz/test
nussaibah shaikh 47b18b6ebd [font] Don't read stale design coords in hb_font_set_variation() (#6402)
hb_font_set_variation() seeds its new design coords from the font's
existing ones for every axis of the current face, trusting an assert
that their lengths match. hb_font_set_face() keeps the font's
variation coords, which stay sized for the old face, so switching to
a face with more axes and then calling hb_font_set_variation() reads
past the old array: a heap-buffer-overflow read with NDEBUG, an
assertion failure otherwise.

Only reuse the existing design coords when their length matches the
current face; otherwise start from the defaults, as when none are set.

Reproduced the overflow under ASan with NDEBUG and the assertion
failure in the default build. Added a regression test in test-font.c
that fails without the fix. The full ASan+UBSan Meson suite passes.

Assisted-by: Claude
2026-10-16 12:18:00 -06:00
..