#!/bin/sh
# DF-0871 build: deterministic harness (buggy + fixed) + NTFS image crafters.
# Run on the DragonFly guest (has /usr/bin/cc) -- no host compiler needed.
set -e
cd "$(dirname "$0")"

echo "[build] crafting EVIL NTFS images (num=1 and num=2)"
python3 craft_img.py ntfs_evil.img 2          # 2 evil entries -> cross-entry OOB
python3 craft_img.py ntfs_evil_n1.img 1        # 1 evil entry  -> OOB past alloc
python3 craft_benign.py ntfs_benign.img        # control: short NUL-terminated names

echo "[build] compiling deterministic harness (BUGGY do/while)"
cc -O2 -o harness harness.c

echo "[build] compiling deterministic harness (FIXED, mirrors fix.diff)"
cc -O2 -o harness_fixed harness_fixed.c

echo "[build] DONE"
ls -l ntfs_evil.img ntfs_evil_n1.img ntfs_benign.img harness harness_fixed
