
* timeout utility * example build.toml * upd * ci * Update build_and_test.yml * Update build_and_test.yml * rename, qemu_launcher * libpngs * fix * upd * del * do_nothing -> unsupported * rename * use command * non qemu fuzzbench * script.sh * mroe * qemu * fix * generic * fix * fix * allow 124 * quotes * fix * fix * fix * stderr to devnull * chg
120 lines
2.6 KiB
TOML
120 lines
2.6 KiB
TOML
# Variables
|
|
[env]
|
|
FUZZER_NAME='fuzzer_libpng'
|
|
LIBAFL_CC = './target/release/libafl_cc'
|
|
LIBAFL_CXX = './target/release/libafl_cxx'
|
|
FUZZER = './target/release/${FUZZER_NAME}'
|
|
PROJECT_DIR = { script = ["pwd"] }
|
|
|
|
[tasks.unsupported]
|
|
script_runner="@shell"
|
|
script='''
|
|
echo "Cargo-make not integrated yet on this"
|
|
'''
|
|
|
|
# libpng
|
|
[tasks.libpng]
|
|
linux_alias = "libpng_unix"
|
|
mac_alias = "libpng_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.libpng_unix]
|
|
condition = { files_not_exist = ["./libpng-1.6.37"]}
|
|
script_runner="@shell"
|
|
script='''
|
|
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
|
|
'''
|
|
|
|
# Compilers
|
|
[tasks.cxx]
|
|
linux_alias = "cxx_unix"
|
|
mac_alias = "cxx_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.cxx_unix]
|
|
command = "cargo"
|
|
args = ["build" , "--release"]
|
|
|
|
[tasks.cc]
|
|
linux_alias = "cc_unix"
|
|
mac_alias = "cc_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.cc_unix]
|
|
command = "cargo"
|
|
args = ["build" , "--release"]
|
|
|
|
# Library
|
|
[tasks.lib]
|
|
linux_alias = "lib_unix"
|
|
mac_alias = "lib_unix"
|
|
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 "${PROJECT_DIR}"
|
|
make -C libpng-1.6.37 CC="${PROJECT_DIR}/target/release/libafl_cc" CXX="${PROJECT_DIR}/target/release/libafl_cxx"
|
|
'''
|
|
dependencies = [ "libpng", "cxx", "cc" ]
|
|
|
|
|
|
# Harness
|
|
[tasks.fuzzer]
|
|
linux_alias = "fuzzer_unix"
|
|
mac_alias = "fuzzer_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.fuzzer_unix]
|
|
command = "target/release/libafl_cxx"
|
|
args = ["${PROJECT_DIR}/harness.cc", "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", "-I", "${PROJECT_DIR}/libpng-1.6.37/", "-o", "${FUZZER_NAME}", "-lm", "-lz"]
|
|
dependencies = [ "lib", "cxx", "cc" ]
|
|
|
|
# Run the fuzzer
|
|
[tasks.run]
|
|
linux_alias = "run_unix"
|
|
mac_alias = "run_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.run_unix]
|
|
script_runner = "@shell"
|
|
script='''
|
|
./${FUZZER_NAME} &
|
|
sleep 0.2
|
|
./${FUZZER_NAME} 2>/dev/null
|
|
'''
|
|
dependencies = [ "fuzzer" ]
|
|
|
|
# Test
|
|
[tasks.test]
|
|
linux_alias = "test_unix"
|
|
mac_alias = "test_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.test_unix]
|
|
script_runner = "@shell"
|
|
script='''
|
|
rm -rf libafl_unix_shmem_server || true
|
|
timeout 11s ./${FUZZER_NAME} &
|
|
sleep 0.2
|
|
timeout 10s ./${FUZZER_NAME} >/dev/null 2>/dev/null &
|
|
'''
|
|
dependencies = [ "fuzzer" ]
|
|
|
|
# Clean up
|
|
[tasks.clean]
|
|
linux_alias = "clean_unix"
|
|
mac_alias = "clean_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.clean_unix]
|
|
# Disable default `clean` definition
|
|
clear = true
|
|
script_runner="@shell"
|
|
script='''
|
|
rm -f ./${FUZZER_NAME}
|
|
make -C libpng-1.6.37 clean
|
|
cargo clean
|
|
''' |