mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 06:21:16 +01:00
Malformed reflected gradients can produce very large finite gradient parameters. The raster backend normalized reflect mode by casting floorf(t) to int, which can overflow and drive LUT lookups past the fixed-size stack buffer. Fold reflected coordinates with fmodf(), clamp LUT inputs defensively, and add the minimized oss-fuzz raster testcase to the corpus. Fixes: https://oss-fuzz.com/testcase-detail/6597066439852032 Tested: meson test -C build 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: