mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
edge_sweep_row() computed the clipped endpoint x coordinates with int32_t subtractions before casting to int64_t. If an edge started at INT32_MIN and the scanline clipped endpoint was near zero, ey - yL overflowed before the slope multiply and UBSan flagged the raster fuzzer path. Keep the endpoint interpolation and follow-on dx math in 64-bit until clamping back to int32_t. This preserves the existing rasterizer logic while avoiding signed overflow for extreme edge coordinates. Tested: - meson test -C build Assisted-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: