-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: toseven <[email protected]> Co-authored-by: Dominik Maier <[email protected]>
- Loading branch information
1 parent
b9a5405
commit 659e91f
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
install_libpng() { | ||
cd ./fuzzers/libfuzzer_libpng && wget https://deac-fra.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.xz | ||
tar -xvf libpng-1.6.37.tar.xz || echo "Failed to download libpng" | ||
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes && cd .. | ||
} | ||
|
||
build_libpng(){ | ||
cargo build --release || echo "ERROR: Failed to build libfuzzer_libpng" | ||
|
||
cd libpng-1.6.37 && make CC="$(pwd)/../target/release/libafl_cc" CXX="$(pwd)/../target/release/ libafl_cxx" -j "$(nproc)" && cd .. | ||
} | ||
|
||
git_checkout(){ | ||
git reset --hard HEAD^ | ||
} | ||
|
||
build_run_fuzzer(){ | ||
./target/release/libafl_cxx ./harness.cc libpng-1.6.37/.libs/libpng16.a -I libpng-1.6.37/ -o fuzzer_libpng -lz -lm || exit 2 | ||
|
||
./fuzzer_libpng > log.txt & | ||
|
||
# wait that fuzzer_libpng become the broker | ||
sleep 1 | ||
|
||
timeout 5m ./fuzzer_libpng > /dev/null 2>&1 & | ||
|
||
while true; do | ||
if grep -q "Broker" log.txt ; then | ||
pkill -9 "fuzzer_libpng" | ||
executions=$(grep -m 1 "Broker" log.txt | awk '{print $14}') | ||
rm -rf ./libafl_unix_shmem_server | ||
echo "${executions%,}" | ||
break | ||
fi | ||
done | ||
} | ||
|
||
main(){ | ||
install_libpng | ||
|
||
build_libpng | ||
echo "start to run the new fuzzer" | ||
new_executions=$(build_run_fuzzer) | ||
|
||
git_checkout | ||
|
||
build_libpng | ||
echo "start to run the last fuzzer" | ||
last_executions=$(build_run_fuzzer) | ||
|
||
echo "the execution count of the new fuzzer is $new_executions" | ||
echo "the execution count of the last fuzzer is $last_executions" | ||
} | ||
|
||
main |