Commit Graph
497 Commits
Author SHA1 Message Date
Behdad Esfahbod 47b0ce552d [fuzzing] Guard raster/vector create_or_fail results
The raster and vector fuzzers called create_or_fail() and then
immediately dereferenced the returned pointers. Under CIFuzz's
allocation-failure coverage, that turns a valid NULL return into a
harness crash instead of treating it as an out-of-memory case.

Return early after cleaning up when draw or paint context creation
fails. This keeps the fuzzers aligned with the create_or_fail()
contract and avoids null-deref crashes unrelated to library logic.

Tested:
- meson compile -C build hb-raster-fuzzer hb-vector-fuzzer
- build/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/TwemojiMozilla.subset.ttf
- build/test/fuzzing/hb-raster-fuzzer test/fuzzing/fonts/TwemojiMozilla.subset.ttf

Assisted-by: OpenAI Codex
2026-03-10 10:04:25 -03:00
Behdad Esfahbod 87333c135c Mark fuzzing helper scripts executable 2026-03-10 01:50:13 -03:00
Behdad Esfahbod 83a5760e09 Add fuzz seed decoder 2026-03-10 01:45:55 -03:00
Behdad Esfahbod bf283f8fde Drop obsolete set-fuzzer corpus 2026-03-10 01:42:32 -03:00
Behdad Esfahbod e73a690d9e Remove hb-set-fuzzer 2026-03-10 01:41:46 -03:00
Behdad Esfahbod a4ce5caeea Add handwriting fuzzer text trailers 2026-03-10 01:38:06 -03:00
Behdad Esfahbod acdf518d42 [fuzzing] Add noto handwriting color fonts
From https://github.com/googlefonts/color-fonts
2026-03-09 23:00:03 -03:00
Behdad Esfahbod b18092024a Add raster and vector fuzzers 2026-03-09 22:13:03 -03:00
Ze Sheng 3db272507d [fuzzer] Fix hb-set-fuzzer reading pointer address instead of input data (#5786)
reinterpret_cast<const instructions_t &>(data) reads the bytes of the
pointer variable itself (stack address, determined by ASLR), not the
fuzzer input buffer. This makes operation and first_set_size effectively
uncontrollable by the fuzzer.

Fix by dereferencing: reinterpret_cast<const instructions_t &>(*data)

This also removes the #pragma suppressing -Wstrict-aliasing, which was
warning about exactly this problem.

Coverage comparison (10-min libFuzzer run):
- Original: 15 lines (0.05%), 2 functions
- Fixed:   486 lines (1.47%), 144 functions (29x improvement)
2026-03-05 07:49:51 -07:00
Behdad Esfahbod 451f32c88e test/fuzzing: rename record-shape script 2026-03-04 17:11:12 -03:00
Behdad Esfahbod b7846647e4 Merge pull request #5781 from harfbuzz/better-fuzzing
Better fuzzing
2026-03-04 10:52:06 -07:00
Behdad Esfahbod d8d5068341 Fix shape fuzzer build 2026-03-04 14:33:24 -03:00
Behdad Esfahbod f111ed9d67 Add shared shape fuzzer seed support 2026-03-04 14:17:00 -03:00
Behdad Esfahbod 638ae0edc8 Support comment-prefixed fuzzing seeds 2026-03-04 14:07:40 -03:00
Behdad Esfahbod 6913fd88b8 [fuzzing] Add --downgrade-cff seed using new facilities 2026-03-04 14:07:08 -03:00
Behdad Esfahbod 7905d59aae Adjust subset seed recorder output paths 2026-03-04 13:59:15 -03:00
Behdad Esfahbod 7672d6bd52 [fuzzing] Add test for --downgrade-cff 2026-03-04 13:58:38 -03:00
Behdad Esfahbod c4ef89c63d Add extended hb-subset fuzzer seed recorder 2026-03-04 13:56:40 -03:00
Khaled Hosny b91d4b8d75 Add meson options to disable building harfbuzz-subset 2026-03-04 18:12:45 +02:00
Qunxin Liu 7ed158f930 Fix fuzzer issue (#5741)
Fixes: https://oss-fuzz.com/testcase-detail/6406793692774400
2026-02-11 13:12:30 -07:00
Qunxin Liu e601560b77 fix fuzzer issue: https://oss-fuzz.com/testcase-detail/6005602106277888
Do not use pointers that may point outside of the allocated memory region
2026-01-23 11:44:39 -07:00
Behdad Esfahbod dc73849f56 [gvar] Fix padding size calcs (#5718)
The previous state of is_long_offset() is irrelevant here.

Fixes https://oss-fuzz.com/testcase-detail/5920156651159552
2026-01-22 18:08:51 -07:00
Qunxin Liu b17fa8ef39 Fix fuzzer found heap-use-after-free crash (#5717)
Fixes https://oss-fuzz.com/testcase-detail/6005602106277888
2026-01-21 14:42:29 -07:00
Behdad Esfahbod bb7dbc25ec Fix some unused-var warnings under NDEBUG 2026-01-10 07:42:07 -07:00
Garret Rieger 09c14fa4f2 Fix fuzzer found memory leak. (#5643)
Fixes https://oss-fuzz.com/testcase-detail/6083012753424384
2025-11-14 02:27:35 -07:00
Behdad Esfahbod 844f2fea06 [GPOS] Handle attach_chain() overflow (#5636)
Fixes https://oss-fuzz.com/testcase-detail/5461871294742528
2025-11-03 20:28:54 -07:00
Behdad Esfahbod f159600ccb Fix a draw fuzzer uninitialized-memory issue (#5615)
Fixes https://oss-fuzz.com/testcase-detail/5714890590584832
2025-10-17 19:49:40 -06:00
Behdad Esfahbod a89c36e0d9 [GPOS/kerx] Support attaching marks to bases after them (#5520)
See comments. Fuzzer found. I'm surprised this was not discovered
before though. I hope I have not missed anything.

Fixes https://oss-fuzz.com/testcase-detail/6399443634290688
2025-09-02 13:05:11 -06:00
Garret Rieger 04d60de6ae [CFF2] Fix fuzzer failure in CFF2.
Fixes https://oss-fuzz.com/testcase-detail/5291661985120256
2025-07-23 12:59:22 -06:00
Behdad Esfahbod ba309a1826 [test/fuzzing] Port all to TAP 2025-04-06 13:54:47 -06:00
Behdad Esfahbod 58d7ab2d59 [meson] Remove unneeded dependencies 2025-04-06 13:42:13 -06:00
Behdad Esfahbod 2b5ae9dec3 [meson] Use a glob.py instead of ls / dir 2025-04-06 12:52:31 -06:00
Behdad Esfahbod b2179dcfcd [meson.build] Another try 2025-04-06 03:03:41 -06:00
Behdad Esfahbod a777a9c535 [meson.build] Try fix using of find 2025-04-06 02:47:06 -06:00
Behdad Esfahbod e332777763 [fuzzing/subset] Make TAP protocol 2025-04-06 02:34:48 -06:00
Behdad Esfahbod 740a103ba1 [meson] See if this fixes bots 2025-04-06 02:34:48 -06:00
Behdad Esfahbod fbda749bdb [meson.build] Try to bring down required version
range() not found
2025-04-06 02:34:48 -06:00
Behdad Esfahbod da5a9fb860 [meson.build] Remove unused fs module 2025-04-06 02:34:48 -06:00
Behdad Esfahbod 1db93d2f6d [test/fuzzing/subset] Run chunks in parallel 2025-04-06 02:34:48 -06:00
Behdad Esfahbod db953a43d0 [meson.build] Cosmetic 2025-04-06 02:34:48 -06:00
Behdad Esfahbod b53000403e [run-fuzzer-tests] Remove duplicate chunksize 2025-04-05 17:15:50 -06:00
Behdad Esfahbod e0aee5815a [test] Respect MESON_EXE_WRAPPER in more test runners
It's not working for me though. Meson doesn't seem to set WINEPATH
during testing.
2025-03-22 14:56:37 -06:00
Behdad Esfahbod 2a878b1b76 [font-funcs] Add two new API
+ hb_font_set_funcs_using()
+ hb_font_list_funcs()

Part of https://github.com/harfbuzz/harfbuzz/issues/5117
2025-03-08 11:50:53 -07:00
Khaled Hosny 7ba3efa5c6 [tests/fuzzing] Use the correct dirs for subset and repacker fuzzers 2025-02-09 18:42:45 +02:00
Khaled Hosny c404d8fc70 [test/fuzzing] Merge hb_fuzzer_tools.py back and simplify 2025-02-09 18:11:38 +02:00
Khaled Hosny 4c43fdcd07 [test/fuzzing] Simplify Python scripts further
We always path the fuzzer path in meson, so we don’t need to search for
fuzzer path in the scripts, and then we can use one script for all the
fuzzers.
2025-02-09 18:11:34 +02:00
Behdad Esfahbod c29b1de39f [test/fuzzing] Remove old cruft 2025-02-09 15:38:18 +00:00
Behdad Esfahbod 86329643fd [test/fuzzing] Call binaries with 64 fonts at a time
Second try... Previous attempt caused a too-many-command-line-args
on Windows.

https://github.com/harfbuzz/harfbuzz/issues/5061
2025-02-09 15:12:03 +00:00
Behdad Esfahbod be22e43d7d [test/fuzzing] Run each fuzzer on all fonts in one process
Much much faster, specially under valgrind, than spawning one process per font.

Fixes https://github.com/harfbuzz/harfbuzz/issues/5061
2025-02-09 14:55:44 +00:00
Behdad Esfahbod 6738ee3d1b [ci/fedora-valgrind] Add time multiplier of 10 and run slow tests 2025-02-09 13:50:27 +00:00