2018-03-22 22:52:07 +01:00
|
|
|
#!/bin/bash
|
2018-04-03 00:39:26 +02:00
|
|
|
set -e
|
2021-04-22 00:24:36 +02:00
|
|
|
set -x
|
2018-05-13 19:17:18 +02:00
|
|
|
|
2019-12-11 19:18:43 +01:00
|
|
|
pushd src/msg_targets
|
|
|
|
rm msg_*.rs
|
|
|
|
./gen_target.sh
|
|
|
|
[ "$(git diff)" != "" ] && exit 1
|
|
|
|
popd
|
|
|
|
pushd src/bin
|
2018-05-13 19:17:18 +02:00
|
|
|
rm *_target.rs
|
|
|
|
./gen_target.sh
|
|
|
|
[ "$(git diff)" != "" ] && exit 1
|
|
|
|
popd
|
|
|
|
|
2022-08-30 06:03:47 +02:00
|
|
|
cargo install --color always --force honggfuzz --no-default-features
|
2020-02-21 02:02:26 +01:00
|
|
|
sed -i 's/lto = true//' Cargo.toml
|
2020-04-24 23:35:18 +02:00
|
|
|
HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" cargo --color always hfuzz build
|
2019-12-11 19:18:43 +01:00
|
|
|
for TARGET in src/bin/*.rs; do
|
2018-05-08 14:57:20 +02:00
|
|
|
FILENAME=$(basename $TARGET)
|
2018-03-22 22:52:07 +01:00
|
|
|
FILE="${FILENAME%.*}"
|
2019-01-07 23:17:36 +01:00
|
|
|
HFUZZ_RUN_ARGS="--exit_upon_crash -v -n2"
|
2019-12-11 19:18:43 +01:00
|
|
|
if [ "$FILE" = "chanmon_consistency_target" ]; then
|
2019-01-07 23:17:36 +01:00
|
|
|
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -F 64 -N100000"
|
2020-04-24 22:56:20 +02:00
|
|
|
elif [ "$FILE" = "full_stack_target" ]; then
|
|
|
|
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N1000000"
|
2019-01-07 23:17:36 +01:00
|
|
|
else
|
|
|
|
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
|
|
|
|
fi
|
|
|
|
export HFUZZ_RUN_ARGS
|
2020-04-24 23:35:18 +02:00
|
|
|
HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" cargo --color always hfuzz run $FILE
|
2018-03-22 22:52:07 +01:00
|
|
|
if [ -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT ]; then
|
|
|
|
cat hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
|
|
|
|
for CASE in hfuzz_workspace/$FILE/SIG*; do
|
|
|
|
cat $CASE | xxd -p
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|