#!/usr/bin/env bash # seed.sh: rebuild fuzz/corpus/ from the crate's test fixtures. # # Frames are cut out of each IVF file (the first 10 frames, frames over 256 KiB skipped) # into corpus/decode_frame/. Whole IVF files up to 256 KiB go into corpus/decode_ivf/, and # a 10-frame prefix of every larger file too. The corpus is generated, not committed. # set -euo pipefail here=$(cd -- "$(dirname -- "$0")" && pwd) repo=$(cd -- "$here/../../.." && pwd) rm -rf "$here/corpus" mkdir -p "$here/corpus/decode_frame" "$here/corpus/decode_ivf" exec python3 -I - "$here" "decode_ivf" "${EC_FIXTURES:-$repo/fixtures}/vp8/*.ivf" <<'PY' import glob, os, struct, sys here, stream_target = sys.argv[1], sys.argv[2] sources = sorted(sum((glob.glob(p) for p in sys.argv[3:]), [])) MAX_FRAMES, MAX_BYTES = 10, 256 * 1024 def split_ivf(data): hdr_len = struct.unpack_from(' len(data): break frames.append(data[pos:pos + size]) pos += size return data[:hdr_len], frames def ivf(header, frames): out = bytearray(header) for i, f in enumerate(frames): out += struct.pack('