mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 18:13:53 +01:00
The raster gradient code assumed every color line had at least one stop. Malformed COLR data can report an empty stop list, which then reaches normalize_color_line() and evaluate_color_line() and reads stops[0]. Treat empty color lines as a failed gradient fetch so malformed inputs render nothing instead of dereferencing past the stop array. Tested: - meson compile -C build hb-raster-fuzzer Fixes: https://oss-fuzz.com/testcase-detail/5216672087867392 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: