2019-08-16 17:55:55 +00:00
|
|
|
function compile_fuzzer {
|
|
|
|
fuzzer=$(basename $1)
|
|
|
|
|
|
|
|
# Instrument all Go files relevant to this fuzzer, compile and store in $fuzzer.a
|
2019-08-21 19:08:22 +00:00
|
|
|
go-fuzz-build -libfuzzer -o $fuzzer.a github.com/dvyukov/go-fuzz-corpus/$fuzzer
|
2019-08-16 17:55:55 +00:00
|
|
|
|
|
|
|
# Instrumented, compiled Go ($fuzzer.a) + libFuzzer = fuzzer binary
|
2019-09-05 22:09:59 +00:00
|
|
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o fuzzer-$fuzzer
|
2019-08-16 17:55:55 +00:00
|
|
|
|
|
|
|
# Copy the fuzzer binary
|
|
|
|
cp fuzzer-$fuzzer $OUT
|
|
|
|
|
|
|
|
# Pack the seed corpus
|
2019-08-21 19:08:22 +00:00
|
|
|
zip -r fuzzer-${fuzzer}_seed_corpus.zip \
|
|
|
|
$GOPATH/src/github.com/dvyukov/go-fuzz-corpus/$fuzzer/corpus
|
2019-08-16 17:55:55 +00:00
|
|
|
|
|
|
|
# Copy the seed corpus
|
|
|
|
cp fuzzer-${fuzzer}_seed_corpus.zip $OUT
|
|
|
|
}
|
|
|
|
|
|
|
|
export -f compile_fuzzer
|
|
|
|
|
|
|
|
# Use this to attempt to compile all
|
2019-08-21 19:08:22 +00:00
|
|
|
#find $SRC/go-fuzz-corpus -mindepth 1 -maxdepth 1 -type d -exec bash -c 'compile_fuzzer "$@"' bash {} \;
|
|
|
|
|
|
|
|
compile_fuzzer asn1
|
|
|
|
#compile_fuzzer bzip2
|
|
|
|
compile_fuzzer csv
|
|
|
|
compile_fuzzer elliptic
|
|
|
|
compile_fuzzer flate
|
|
|
|
compile_fuzzer fmt
|
|
|
|
#compile_fuzzer gif
|
|
|
|
compile_fuzzer gzip
|
|
|
|
compile_fuzzer httpreq
|
|
|
|
compile_fuzzer httpresp
|
|
|
|
compile_fuzzer jpeg
|
|
|
|
compile_fuzzer json
|
|
|
|
compile_fuzzer lzw
|
|
|
|
compile_fuzzer mime
|
|
|
|
compile_fuzzer multipart
|
|
|
|
compile_fuzzer png
|
|
|
|
compile_fuzzer tar
|
|
|
|
compile_fuzzer time
|
|
|
|
#compile_fuzzer url
|
|
|
|
compile_fuzzer xml
|
|
|
|
compile_fuzzer zip
|
|
|
|
compile_fuzzer zlib
|
2019-08-16 17:55:55 +00:00
|
|
|
|