2023-03-22 13:55:08 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-04-02 22:44:02 +00:00
|
|
|
set -e
|
2019-12-08 16:39:46 +00:00
|
|
|
|
2023-03-22 13:55:08 +00:00
|
|
|
REPO_DIR=$(git rev-parse --show-toplevel)
|
2019-12-08 16:39:46 +00:00
|
|
|
|
2023-03-22 13:55:08 +00:00
|
|
|
# shellcheck source=./fuzz-util.sh
|
|
|
|
source "$REPO_DIR/fuzz/fuzz-util.sh"
|
|
|
|
|
|
|
|
# Check that input files are correct Windows file names
|
|
|
|
checkWindowsFiles
|
2019-12-08 16:39:46 +00:00
|
|
|
|
2022-08-30 20:22:47 +00:00
|
|
|
if [ "$1" == "" ]; then
|
2023-03-22 13:55:08 +00:00
|
|
|
targetFiles="$(listTargetFiles)"
|
2022-08-30 20:22:47 +00:00
|
|
|
else
|
2023-03-22 13:55:08 +00:00
|
|
|
targetFiles=fuzz_targets/"$1".rs
|
2022-08-30 20:22:47 +00:00
|
|
|
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
|
2023-03-22 13:55:08 +00:00
|
|
|
for targetFile in $targetFiles; do
|
|
|
|
targetName=$(targetFileToName "$targetFile")
|
|
|
|
echo "Fuzzing target $targetName ($targetFile)"
|
|
|
|
if [ -d "hfuzz_input/$targetName" ]; then
|
|
|
|
HFUZZ_INPUT_ARGS="-f hfuzz_input/$targetName/input\""
|
|
|
|
else
|
|
|
|
HFUZZ_INPUT_ARGS=""
|
|
|
|
fi
|
2023-03-22 18:03:04 +00:00
|
|
|
HFUZZ_RUN_ARGS="--run_time 30 --exit_upon_crash -v $HFUZZ_INPUT_ARGS" cargo hfuzz run "$targetName"
|
2018-04-16 20:27:17 +00:00
|
|
|
|
2023-03-22 13:55:08 +00:00
|
|
|
checkReport "$targetName"
|
2018-03-20 16:28:18 +00:00
|
|
|
done
|