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>
Security Fuzzers
To build the fuzzers with libFuzzer to perform actual fuzzing, build with:
CXX=clang++ CXXFLAGS="-fsanitize=address,fuzzer-no-link" meson fuzzbuild --default-library=static -Dfuzzer_ldflags="-fsanitize=address,fuzzer"
ninja -Cfuzzbuild
Then, run the fuzzer like this:
fuzzbuild/test/fuzzing/hb-{shape,raster,vector,subset,repacker,depend}-fuzzer [-max_len=2048] [CORPUS_DIR]
Where max_len specifies the maximal length of font files to handle. The smaller the faster.
Note: The depend fuzzer requires -Ddepend_api=true meson option.
For more details consult the following locations:
Depend Closure Parity Test
The hb-depend-closure-parity test is distinct from the security fuzzers.
While security fuzzers test robustness against malformed input, the closure
parity test validates correctness by emulating the glyph closure calculation
used for subsetting with one generated from the dependency graph to avoid
implementation divergence. It should only be run on valid fonts.