mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 15:31:05 +01:00
Glyph::get_points() uses scratch.comp_points as a stack shared by all recursion levels: it appends one point per component plus four phantoms, and every exit restores points.length to old_length -- except the exit taken when gvar->apply_deltas_to_points() returns false (for example on a tuple whose variationDataSize overruns its data). Because the hb_glyf_scratch_t is cached on the glyf (and VARC) accelerator for the life of the face, every failed depth-0 load grows the vector permanently, until it reaches its allocation ceiling; a VARC font can drive hundreds of thousands of such failing leaf loads within one glyph budget, leaving tens of megabytes behind per extents or draw call. Balance the missing exit the way every sibling exit (and #6410) already does. Also clear comp_points next to the existing all_points.clear() at the depth-0 entry in glyf_accelerator_t::get_points(), the only entry into the cached scratch (the subsetter's call uses a local scratch), so the cached vector can never carry stale points across loads even if a future exit forgets the discipline. No behaviour change for well-formed fonts: the resize only runs on the failure path and comp_points is empty at entry when exits are balanced. Adds a minimized VARC+gvar font to test/fuzzing/fonts exercising the failing path through the shape/draw/raster/vector/subset fuzzers. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-NM4GCMBX. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>