From 5a8bcf138668a46c3187c13941ce127da0ded8ff Mon Sep 17 00:00:00 2001 From: Krzysztof Kowalczyk Date: Tue, 30 Jan 2018 22:55:07 -0800 Subject: [PATCH] add script to automate fuzzing --- .gitignore | 2 ++ s/fuzz.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 s/fuzz.sh diff --git a/.gitignore b/.gitignore index 75623dc..1cc35a0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ _obj _test* markdown tags +fuzz-workdir/ +markdown-fuzz.zip diff --git a/s/fuzz.sh b/s/fuzz.sh new file mode 100755 index 0000000..6c4eb78 --- /dev/null +++ b/s/fuzz.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -u -e -o pipefail + +# This runs a go-fuzz as described in: +# https://medium.com/@dgryski/go-fuzz-github-com-arolek-ase-3c74d5a3150c +# https://github.com/dvyukov/go-fuzz + +go get github.com/dvyukov/go-fuzz/go-fuzz +go get github.com/dvyukov/go-fuzz/go-fuzz-build + +# this step is expensive, so re-use previous runs if possible +if [ ! -f ./markdown-fuzz.zip ]; then + mkdir -p fuzz-workdir/corpus + cp testdata/*.text fuzz-workdir/corpus + echo "running go-fuzz-build, might take a while..." + go-fuzz-build github.com/gomarkdown/markdown +fi + +echo "running go-fuzz" +go-fuzz -bin=./markdown-fuzz.zip -workdir=fuzz-workdir