
* Add mute_inprocess_target fn, SimpleFdLogger::set_logger, set_error_print_panic_hook * Trying to fix #1753 * typo * More fix * Fix test? * more testcase fixes
117 lines
2.7 KiB
TOML
117 lines
2.7 KiB
TOML
# Variables
|
|
[env]
|
|
CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = ["CARGO_TARGET_DIR"] } }
|
|
PROFILE = { value = "release", condition = {env_not_set = ["PROFILE"]} }
|
|
PROFILE_DIR = {value = "release", condition = {env_not_set = ["PROFILE_DIR"] }}
|
|
|
|
[tasks.unsupported]
|
|
script_runner="@shell"
|
|
script='''
|
|
echo "Cargo-make not integrated yet on this"
|
|
'''
|
|
|
|
# libpng
|
|
[tasks.libpng]
|
|
linux_alias = "libpng_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.libpng_unix]
|
|
condition = { files_not_exist = ["./libpng-1.6.37"]}
|
|
script_runner="@shell"
|
|
script='''
|
|
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
|
|
tar -xvf v1.6.37.tar.gz
|
|
'''
|
|
|
|
# Library
|
|
[tasks.lib]
|
|
linux_alias = "lib_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.lib_unix]
|
|
script_runner="@shell"
|
|
script='''
|
|
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
|
|
cd ..
|
|
make -C libpng-1.6.37
|
|
'''
|
|
dependencies = [ "libpng" ]
|
|
|
|
# Harness
|
|
[tasks.harness]
|
|
linux_alias = "harness_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.harness_unix]
|
|
script_runner="@shell"
|
|
script='''
|
|
clang++ -O0 -c -fPIC harness.cc -o harness.o
|
|
clang++ -O0 harness.cc libpng-1.6.37/.libs/libpng16.a -lz -o libpng-harness -g
|
|
'''
|
|
dependencies = [ "lib" ]
|
|
|
|
# Fuzzer
|
|
[tasks.fuzzer]
|
|
linux_alias = "fuzzer_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.fuzzer_unix]
|
|
script_runner="@shell"
|
|
script='''
|
|
cargo build --profile ${PROFILE}
|
|
'''
|
|
|
|
# Run the fuzzer
|
|
[tasks.run]
|
|
linux_alias = "run_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.run_unix]
|
|
script_runner = "@shell"
|
|
script='''
|
|
LD_PRELOAD=$CARGO_TARGET_DIR/${PROFILE_DIR}/libfrida_executable_fuzzer.so ./libpng-harness -i corpus -o out -H ./libpng-harness
|
|
'''
|
|
dependencies = [ "fuzzer", "harness" ]
|
|
|
|
# Test
|
|
[tasks.test]
|
|
linux_alias = "test_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.test_unix]
|
|
script_runner = "@shell"
|
|
script='''
|
|
rm -rf libafl_unix_shmem_server || true
|
|
LD_PRELOAD=$CARGO_TARGET_DIR/${PROFILE_DIR}/libfrida_executable_fuzzer.so ./libpng-harness -i corpus -o out -H ./libpng-harness > fuzz_stdout.log &
|
|
sleep 10s && pkill libpng-harness
|
|
if grep -qa "corpus: 30" fuzz_stdout.log; then
|
|
echo "Fuzzer is working"
|
|
else
|
|
echo "Fuzzer does not generate any testcases or any crashes"
|
|
exit 1
|
|
fi
|
|
'''
|
|
dependencies = [ "fuzzer", "harness" ]
|
|
|
|
# Clean up
|
|
[tasks.clean]
|
|
linux_alias = "clean_unix"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.clean_unix]
|
|
# Disable default `clean` definition
|
|
clear = true
|
|
script_runner="@shell"
|
|
script='''
|
|
rm -f ./libpng-harness
|
|
make -C libpng-1.6.37 clean
|
|
cargo clean
|
|
'''
|