call afl-cmin.py if it can be executed successfully

This commit is contained in:
Kuang-che Wu
2025-05-08 21:52:12 +08:00
parent ec27e96486
commit 3f2e03aaf9

View File

@ -4,11 +4,17 @@ test "$SYS" = "Darwin" && {
echo Error: afl-cmin does not work on Apple currently. please use afl-cmin.bash instead.
exit 1
}
THISPATH=`dirname ${0}`
# call afl-cmin.py if it can be executed successfully.
if $THISPATH/afl-cmin.py --help > /dev/null 2>&1; then
exec $THISPATH/afl-cmin.py "$@"
fi
export AFL_QUIET=1
export ASAN_OPTIONS=detect_leaks=0
THISPATH=`dirname ${0}`
export PATH="${THISPATH}:$PATH"
awk -v script_dir="$THISPATH" -f - -- ${@+"$@"} <<'EOF'
awk -f - -- ${@+"$@"} <<'EOF'
#!/usr/bin/awk -f
# awk script to minimize a test corpus of input files
#
@ -258,10 +264,6 @@ BEGIN {
# sanity checks
if (!prog_args[0] || !in_dir || !out_dir) usage()
if (0 == system( script_dir "/afl-cmin.py --help > /dev/null 2>&1" )) {
print "[*] Are you aware of the experimental afl-cmin.py that minimize corpus much faster?"
}
target_bin = prog_args[0]
# Do a sanity check to discourage the use of /tmp, since we can't really