From 3f2e03aaf9725ed0ff1ffc6b03354a1ce45cf0c5 Mon Sep 17 00:00:00 2001 From: Kuang-che Wu Date: Thu, 8 May 2025 21:52:12 +0800 Subject: [PATCH] call afl-cmin.py if it can be executed successfully --- afl-cmin | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/afl-cmin b/afl-cmin index 08dcbcae..baa003c5 100755 --- a/afl-cmin +++ b/afl-cmin @@ -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