| 1 | # Fuzz Corpus |
| 2 | |
| 3 | Seed inputs for `chdr-fuzz` (built with `-DBUILD_FUZZER=ON`). |
| 4 | |
| 5 | This directory is gitignored except for the scripts below. Populate it |
| 6 | before running the fuzzer. |
| 7 | |
| 8 | ## Generate synthetic CHDv5 samples (fast, reproducible) |
| 9 | |
| 10 | Requires `chdman` (from MAME) in `$PATH`. |
| 11 | |
| 12 | ./generate.sh |
| 13 | |
| 14 | Produces tiny CHDs (each < 100 KB) covering: |
| 15 | |
| 16 | - CHD types: raw, hard disk, CD-ROM |
| 17 | - Compression codecs: none, zlib, lzma, huff, flac, zstd, cdzl, cdlz, |
| 18 | cdfl, cdzs |
| 19 | |
| 20 | All outputs are CHDv5 — modern `chdman` emits v5 exclusively. |
| 21 | |
| 22 | ## Fetch real CHDv4 samples (optional) |
| 23 | |
| 24 | ./fetch.sh |
| 25 | |
| 26 | Downloads a small set of publicly redistributable CHDv4 test images. |
| 27 | Skipped if network access is unavailable. |
| 28 | |
| 29 | Generated `.chd` files land under `tests/corpus/seeds/`, which is |
| 30 | gitignored. The scripts and this README live at `tests/corpus/` and |
| 31 | are tracked. |
| 32 | |
| 33 | ## Run the fuzzer |
| 34 | |
| 35 | cmake -B build -DBUILD_FUZZER=ON -DCMAKE_C_COMPILER=clang |
| 36 | cmake --build build --target chdr-fuzz |
| 37 | ./build/tests/chdr-fuzz -max_len=131072 tests/corpus/seeds |