Files
harfbuzz/test/fuzzing
Behdad Esfahbod df4be0cec8 [gpu] Use vector.reset() not resize(0) in hb_gpu_paint_clear
Three accumulator vectors -- ops, sub_blobs, transform_stack --
can enter error state via failed push_or_fail() under
failing-malloc.  Once in error state, resize(0) short-circuits
at the in_error() guard in alloc() and leaves length unchanged.

In hb_gpu_paint_clear that means the next iteration's clear
walks the stale entries again.  For sub_blobs this is a
double-destroy: the blob pointers were already freed in the
previous clear, and hb_blob_destroy reads the dead ref_count
field -- heap-use-after-free.

Fix by calling vector.reset(), which clears the error state
before resizing to 0.  Matches the pattern hb_gpu_draw_clear
already uses for draw->curves.

Found by oss-fuzz/CIFuzz on hb-gpu-fuzzer; minimized testcase
added to the fuzz corpus.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-14 21:49:12 -06:00
..
2023-05-27 01:16:46 +02:00
2025-04-06 02:34:48 -06:00
2026-03-27 15:18:47 -06:00
2026-03-09 22:13:03 -03:00

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,set}-fuzzer [-max_len=2048] [CORPUS_DIR]

Where max_len specifies the maximal length of font files to handle. The smaller the faster.

For more details consult the following locations: