mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
The raster and vector fuzzers called create_or_fail() and then immediately dereferenced the returned pointers. Under CIFuzz's allocation-failure coverage, that turns a valid NULL return into a harness crash instead of treating it as an out-of-memory case. Return early after cleaning up when draw or paint context creation fails. This keeps the fuzzers aligned with the create_or_fail() contract and avoids null-deref crashes unrelated to library logic. Tested: - meson compile -C build hb-raster-fuzzer hb-vector-fuzzer - build/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/TwemojiMozilla.subset.ttf - build/test/fuzzing/hb-raster-fuzzer test/fuzzing/fonts/TwemojiMozilla.subset.ttf Assisted-by: OpenAI Codex
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: