mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 16:31:14 +01:00
The GPU fuzzer can build outline data large enough to stress the size math inside hb_gpu_draw_encode(). Several totals and byte counts were computed with unchecked unsigned arithmetic before the existing bounds checks ran. Use HarfBuzz's overflow helpers for band-index totals, encoded blob lengths, byte sizes, and recycled-buffer growth. Also rewrite the uint16-offset limit check so it does not rely on subtracting from an already-overflowed total. Testing: - meson test -C build --suite fuzzing --print-errorlogs - meson test -C build Fixes: https://oss-fuzz.com/testcase-detail/6336503637934080 Co-authored-by: OpenAI Codex <codex@openai.com>
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: