mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
The raster paint clip code indexed non-rect clip alpha rows directly, assuming the clip metadata always matched a full stride*height backing buffer. Fuzzing showed that reused clip objects can reach those reads with stale scalar state, which turns the row access in push_clip_rectangle() into a heap-buffer-overflow. Reset cached clip geometry on acquire, add a validity check for non-rect alpha masks, and refuse to build new clip intersections from an invalid mask. The fallback is an empty clip, which keeps the paint path safe without affecting well-formed clips. Testing: - meson test -C build --suite fuzzing --print-errorlogs - 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: