From 41ea9d49309febe5292cf3b8b45515f15ea7efce Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Fri, 5 Aug 2022 21:04:37 -0400 Subject: [PATCH] fuzzers: add httpecho fuzzer script Change-Id: Iab296461ac47d0ee23c23bf3629f7a08f77e238a Signed-off-by: Ashod Nakashian --- fuzzer/README | 8 ++++++++ fuzzer/httpecho-fuzz.sh | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 fuzzer/httpecho-fuzz.sh diff --git a/fuzzer/README b/fuzzer/README index 656a6e0869..20a8aaf4f1 100644 --- a/fuzzer/README +++ b/fuzzer/README @@ -24,3 +24,11 @@ Run the fuzzers like this: ---- ./httpresponse_fuzzer -max_len=16384 fuzzer/httpresponse-data/ ---- + +- HttpEcho: + +---- +./httpecho_fuzzer -max_len=16384 fuzzer/httpecho-data/ +OR, better: +./fuzzer/httpecho-fuzz.sh +---- diff --git a/fuzzer/httpecho-fuzz.sh b/fuzzer/httpecho-fuzz.sh new file mode 100755 index 0000000000..83b3b8e090 --- /dev/null +++ b/fuzzer/httpecho-fuzz.sh @@ -0,0 +1,25 @@ +set -x +set -e + +DATADIR=./fuzzer/httpecho-data + +TMPDIR=/tmp/httpecho_fuzzer_output +mkdir -p $TMPDIR + +export LLVM_PROFILE_FILE="httpecho_fuzzer.profraw.%p.%6m" + + +function h2o() +{ + (cd /tmp/h2o && git pull -r) || (cd /tmp && git clone https://github.com/h2o/h2o.git) + H2O='/tmp/h2o/fuzz/http1-corpus /tmp/h2o/fuzz/http2-corpus /tmp/h2o/fuzz/http3-corpus' +} + +# Uncomment to download the h2o fuzzing corpus. +#h2o + +./httpecho_fuzzer -verbosity=1 -timeout=1 -max_len=16384 -dict=${DATADIR}/http.dict -jobs=5 -detect_leaks=1 $* $TMPDIR ${DATADIR}/corpus/ $H2O + +# To merge, run: +#./httpecho_fuzzer -verbosity=1 -timeout=10 -max_len=16384 $* -merge=1 ${DATADIR}/corpus/ $TMPDIR +