#!/usr/bin/env bash # seed.sh: fill fuzz/corpus// for the ec-riff targets. # # wav_read gets every root fixtures/audio/*.wav as-is, plus an RF64 copy of each (the RIFF # magic swapped for RF64, so the unsupported-RF64 branch is reached too). # avi_read and avi_seek get the AVI files in fixtures/audio/*.avi when there are any, plus a # few synthetic AVIs written here (the repo has no AVI fixture yet). avi_seek gets # the same files behind its 10-byte control prefix. # # Corpus lives under fuzz/corpus, which is git-ignored. set -euo pipefail FUZZ_DIR=$(cd -- "$(dirname -- "$0")" && pwd) FIXTURES=${EC_FIXTURES:-$(cd -- "$FUZZ_DIR/../../.." && pwd)/fixtures}/audio [ -d "$FIXTURES" ] || { echo "seed.sh: $FIXTURES missing; run scripts/fixtures.sh" >&2; exit 2; } WAVS=("$FIXTURES"/*.wav) [ -e "${WAVS[0]}" ] || { echo "seed.sh: no *.wav fixtures in $FIXTURES" >&2; exit 2; } WAV_DIR="$FUZZ_DIR/corpus/wav_read" AVI_DIR="$FUZZ_DIR/corpus/avi_read" SEEK_DIR="$FUZZ_DIR/corpus/avi_seek" mkdir -p "$WAV_DIR" "$AVI_DIR" "$SEEK_DIR" python3 -I - "$FIXTURES" "$WAV_DIR" "$AVI_DIR" "$SEEK_DIR" <<'PY' import glob, os, struct, sys fixtures, wav_dir, avi_dir, seek_dir = sys.argv[1:5] # RF64 copy: "RIFF" -> "RF64" and a ds64 chunk after the WAVE tag. The sizes in the file # stay as they were, so the reader still sees a fixed-size data chunk. def rf64_copy(data): ds64 = b"ds64" + struct.pack("