mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 06:21:16 +01:00
Font funcs and their data may hold pointers into the font's face. hb_font_set_face() released the old face but kept those funcs, causing stale lookups or a use-after-free when the last face reference was gone. Release the font funcs and their data while the old face is still alive, then install the default funcs for the new face. Preserve the other font properties and document the callback reset in the API docs and NEWS. Add regressions for OpenType lookups and custom font-data destruction. Reproduced stale glyph lookup and the heap-use-after-free under ASan before the fix. The full ASan Meson suite passes (270 passed, 1 skipped), and the two regressions also pass with HB_FONT_FUNCS=ft. Assisted-by: Claude Assisted-by: Codex