aboutsummaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-11 19:59:31 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-10-11 20:04:34 +0200
commitdf3f53bd5c370dcd46074189f3ad545c6aab942b (patch)
treebe27ba0d62132173f9bd0f9a2d5779792e92df65 /fuzz
parente029aae1d3d1884ca868c3694bdec0456b3e8267 (diff)
downloadliberty-df3f53bd5c370dcd46074189f3ad545c6aab942b.tar.gz
liberty-df3f53bd5c370dcd46074189f3ad545c6aab942b.tar.xz
liberty-df3f53bd5c370dcd46074189f3ad545c6aab942b.zip
Add a basic fuzzing framework using libFuzzer
Updates #1
Diffstat (limited to 'fuzz')
-rwxr-xr-xfuzz18
1 files changed, 18 insertions, 0 deletions
diff --git a/fuzz b/fuzz
new file mode 100755
index 0000000..0964712
--- /dev/null
+++ b/fuzz
@@ -0,0 +1,18 @@
+#!/bin/sh
+# I'm not sure how to make maximum use of this invention
+# Make sure to have llvm-symbolizer installed
+clang -g -fsanitize=address,undefined,fuzzer -fno-sanitize-recover=all \
+ tests/fuzz.c -o fuzz-executor
+
+fuzz () {
+ echo "`tput bold`-- Fuzzing $1`tput sgr0`"
+ mkdir -p /tmp/corpus-$1
+ ./fuzz-executor -test=$1 -artifact_prefix=$1- \
+ -max_len=32 -max_total_time=600 -timeout=1 /tmp/corpus-$1
+}
+
+if [ $# -gt 0 ]; then
+ for test in "$@"; do fuzz $test; done
+else
+ for test in $(./fuzz-executor); do fuzz $test; done
+fi