ref: 5c3275ef0d7eca27e9965207d88cb9039c2d48da
parent: fadaadd828f2865098bd0ace975a6d7613da0bac
author: lieff <lieff@users.noreply.github.com>
date: Mon Feb 12 20:41:03 EST 2018
add fuzzing scripts
--- /dev/null
+++ b/scripts/fuzz.sh
@@ -1,0 +1,8 @@
+_FILENAME=${0##*/}
+CUR_DIR=${0/${_FILENAME}}
+CUR_DIR=$(cd $(dirname ${CUR_DIR}); pwd)/$(basename ${CUR_DIR})/
+
+pushd $CUR_DIR/..
+
+afl-clang-fast -fsanitize=address,undefined -fno-sanitize-recover=address,undefined -DFUZZ -o minimp3_fuzz minimp3_test.c -lm
+afl-fuzz -d -m none -i vectors/fuzz -o fuzz_out -- ./minimp3_fuzz @@
\ No newline at end of file
--- /dev/null
+++ b/scripts/fuzz_init.sh
@@ -1,0 +1,3 @@
+sudo bash -c 'echo core >/proc/sys/kernel/core_pattern'
+cd /sys/devices/system/cpu
+sudo bash -c 'echo performance | tee cpu*/cpufreq/scaling_governor'
--- /dev/null
+++ b/scripts/test_fuzz.sh
@@ -1,0 +1,17 @@
+_FILENAME=${0##*/}
+CUR_DIR=${0/${_FILENAME}}
+CUR_DIR=$(cd $(dirname ${CUR_DIR}); pwd)/$(basename ${CUR_DIR})/
+
+pushd $CUR_DIR/..
+
+APP=./minimp3_fuzz
+
+set +e
+for i in fuzz_out/crashes/*; do
+$APP $i
+retval=$?
+echo $i exited with code=$retval
+if [ ! $retval -eq 0 ]; then
+ exit 1
+fi
+done
binary files /dev/null b/vectors/fuzz/l3-compl-cut.mp3 differ