| 1 | #!/usr/bin/env bash |
| 2 | # Optional: fetch small publicly redistributable CHDv4 samples. |
| 3 | # The modern chdman only emits CHDv5, so this supplements generate.sh |
| 4 | # with legacy-format coverage for the fuzz corpus. |
| 5 | set -euo pipefail |
| 6 | |
| 7 | CORPUS="$(cd "$(dirname "$0")" && pwd)/seeds" |
| 8 | mkdir -p "$CORPUS" |
| 9 | |
| 10 | fetch () { |
| 11 | local url="$1" out="$2" |
| 12 | if [ -f "$CORPUS/$out" ]; then |
| 13 | echo " $out: already present" |
| 14 | return |
| 15 | fi |
| 16 | if curl -fsSL --max-time 30 -o "$CORPUS/$out" "$url"; then |
| 17 | echo " $out: ok ($(stat -c%s "$CORPUS/$out") bytes)" |
| 18 | else |
| 19 | echo " $out: fetch failed — skipping" |
| 20 | rm -f "$CORPUS/$out" |
| 21 | fi |
| 22 | } |
| 23 | |
| 24 | # Add trusted small-CHDv4 URLs here when identified. |
| 25 | # Intentionally empty at the start; contributors can add sources that |
| 26 | # are small (< 1 MiB), publicly redistributable, and pin a known hash. |
| 27 | echo "(no CHDv4 sources configured yet — edit tests/corpus/fetch.sh)" |