mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 14:01:10 +01:00
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