2019-10-11 18:40:23 +00:00
|
|
|
function compile_fuzzer {
|
|
|
|
path=$1
|
|
|
|
function=$2
|
|
|
|
fuzzer=$3
|
|
|
|
|
|
|
|
# Instrument all Go files relevant to this fuzzer
|
|
|
|
go-fuzz-build -libfuzzer -func $function -o $fuzzer.a $path
|
|
|
|
|
|
|
|
# Instrumented, compiled Go ($fuzzer.a) + fuzzing engine = fuzzer binary
|
|
|
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o $OUT/$fuzzer
|
|
|
|
}
|
|
|
|
|
|
|
|
for x in internal/fuzz/*; do
|
2019-12-21 05:10:19 +00:00
|
|
|
if [ -d $x/corpus ]; then
|
|
|
|
name=$(basename $x)
|
|
|
|
compile_fuzzer ./$x Fuzz $name
|
|
|
|
zip -jr $OUT/${name}_seed_corpus.zip $x/corpus
|
2019-10-11 18:40:23 +00:00
|
|
|
fi
|
|
|
|
done
|