mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 08:21:32 +01:00
COLR ColorLine::get_extend() cast the raw Extend byte directly to hb_paint_extend_t. Malformed tables can carry out-of-range values, which then trip UBSan enum checks in vector paint paths. Map raw extend values explicitly and fall back to PAD for unknown values. Tested: - CCACHE_DISABLE=1 ninja -C /home/behdad/harfbuzz/build-codex test/fuzzing/hb-vector-fuzzer test/fuzzing/hb-raster-fuzzer - ./build-codex/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-vector-fuzzer-5448347908636672 - ./build-codex/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/NotoColorEmoji.subset.ttf Fixes: https://oss-fuzz.com/testcase-detail/6120408016551936 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: