mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-29 09:34:05 +01:00
hb_raster_draw_render() computed y_top by left-shifting a signed value that can be negative when extents have a negative y origin. Switch to 64-bit multiplication by HB_RASTER_ONE_PIXEL and clamp to int32_t range before use, preserving behavior without signed-shift UB. Tested: - CCACHE_DISABLE=1 ninja -C /home/behdad/harfbuzz/build-codex test/fuzzing/hb-raster-fuzzer - ./build-codex/test/fuzzing/hb-raster-fuzzer test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-raster-fuzzer-6454028543524864 Fixes: https://oss-fuzz.com/testcase-detail/6454028543524864 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: