2018-03-20 16:28:18 +00:00
|
|
|
#!/bin/bash
|
2018-04-02 22:44:02 +00:00
|
|
|
set -e
|
2019-12-08 16:39:46 +00:00
|
|
|
|
|
|
|
# Check that input files are correct Windows file names
|
|
|
|
incorrectFilenames=$(find . -type f -name "*,*" -o -name "*:*" -o -name "*<*" -o -name "*>*" -o -name "*|*" -o -name "*\?*" -o -name "*\**" -o -name "*\"*" | wc -l)
|
|
|
|
|
|
|
|
if [ ${incorrectFilenames} -gt 0 ]; then
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2022-08-30 20:22:47 +00:00
|
|
|
if [ "$1" == "" ]; then
|
|
|
|
TARGETS=fuzz_targets/*
|
|
|
|
else
|
|
|
|
TARGETS=fuzz_targets/"$1".rs
|
|
|
|
fi
|
|
|
|
|
|
|
|
cargo --version
|
|
|
|
rustc --version
|
|
|
|
|
2019-12-08 16:39:46 +00:00
|
|
|
# Testing
|
2022-08-30 17:19:39 +00:00
|
|
|
cargo install --force honggfuzz --no-default-features
|
2022-08-30 20:22:47 +00:00
|
|
|
for TARGET in $TARGETS; do
|
|
|
|
echo "Fuzzing target $TARGET"
|
2019-12-08 16:39:46 +00:00
|
|
|
FILENAME=$(basename $TARGET)
|
2018-03-20 16:28:18 +00:00
|
|
|
FILE="${FILENAME%.*}"
|
2018-04-16 20:27:17 +00:00
|
|
|
if [ -d hfuzz_input/$FILE ]; then
|
|
|
|
HFUZZ_INPUT_ARGS="-f hfuzz_input/$FILE/input"
|
|
|
|
fi
|
2019-06-07 11:07:50 +00:00
|
|
|
HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" HFUZZ_RUN_ARGS="--run_time 30 --exit_upon_crash -v $HFUZZ_INPUT_ARGS" cargo hfuzz run $FILE
|
2018-04-16 20:27:17 +00:00
|
|
|
|
2018-04-02 22:44:02 +00:00
|
|
|
if [ -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT ]; then
|
2018-03-20 16:28:18 +00:00
|
|
|
cat hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
|
|
|
|
for CASE in hfuzz_workspace/$FILE/SIG*; do
|
|
|
|
cat $CASE | xxd -p
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|