Minimize corpus

This commit is contained in:
Matthew Knight 2026-03-06 01:21:10 -08:00
parent ba3393f792
commit 7c4aebc9d8
No known key found for this signature in database
1 changed files with 18 additions and 0 deletions

View File

@ -166,6 +166,24 @@ runs:
fi
echo "Fuzz binary: ${FUZZ_BIN}"
# ── Minimize corpus ──
SEED_COUNT=$(find "${SEEDS}" -maxdepth 1 -type f | wc -l)
if [ "${SEED_COUNT}" -gt 1 ]; then
echo "Minimizing corpus (${SEED_COUNT} inputs)..."
MINIMIZED="afl-cmin-${TARGET_NUM}"
rm -rf "${MINIMIZED}"
mkdir -p "${MINIMIZED}"
if afl-cmin -i "${SEEDS}" -o "${MINIMIZED}" -- "${FUZZ_BIN}" >/dev/null 2>&1; then
MINIMIZED_COUNT=$(find "${MINIMIZED}" -maxdepth 1 -type f | wc -l)
echo "Corpus minimized: ${SEED_COUNT} -> ${MINIMIZED_COUNT} inputs"
rm -rf "${SEEDS}"
mv "${MINIMIZED}" "${SEEDS}"
else
echo "afl-cmin failed, using unminimized corpus"
rm -rf "${MINIMIZED}"
fi
fi
# ── Run AFL++ ──
FINDINGS="findings-${TARGET_NUM}"
rm -rf "${FINDINGS}"