Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 14 additions & 24 deletions oss-fuzz-build.sh
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
#!/bin/bash -eu

function compile_fuzzer {
path=$1
function=$2
fuzzer=$3

go-fuzz -func $function -o $fuzzer.a $path

$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer
}

git clone https://github.com/dvyukov/go-fuzz-corpus
zip corpus.zip go-fuzz-corpus/json/corpus/*

cp corpus.zip $OUT/fuzzparsestring_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzParseString fuzzparsestring
compile_go_fuzzer github.com/buger/jsonparser FuzzParseString fuzzparsestring

cp corpus.zip $OUT/fuzzeachkey_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzEachKey fuzzeachkey
compile_go_fuzzer github.com/buger/jsonparser FuzzEachKey fuzzeachkey

cp corpus.zip $OUT/fuzzdelete_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzDelete fuzzdelete
compile_go_fuzzer github.com/buger/jsonparser FuzzDelete fuzzdelete

cp corpus.zip $OUT/fuzzset_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzSet fuzzset
compile_go_fuzzer github.com/buger/jsonparser FuzzSet fuzzset

cp corpus.zip $OUT/fuzzobjecteach_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzObjectEach fuzzobjecteach
compile_go_fuzzer github.com/buger/jsonparser FuzzObjectEach fuzzobjecteach

cp corpus.zip $OUT/fuzzparsefloat_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzParseFloat fuzzparsefloat
compile_go_fuzzer github.com/buger/jsonparser FuzzParseFloat fuzzparsefloat

cp corpus.zip $OUT/fuzzparseint_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzParseInt fuzzparseint
compile_go_fuzzer github.com/buger/jsonparser FuzzParseInt fuzzparseint

cp corpus.zip $OUT/fuzzparsebool_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzParseBool fuzzparsebool
compile_go_fuzzer github.com/buger/jsonparser FuzzParseBool fuzzparsebool

cp corpus.zip $OUT/fuzztokenstart_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzTokenStart fuzztokenstart
compile_go_fuzzer github.com/buger/jsonparser FuzzTokenStart fuzztokenstart

cp corpus.zip $OUT/fuzzgetstring_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzGetString fuzzgetstring
compile_go_fuzzer github.com/buger/jsonparser FuzzGetString fuzzgetstring

cp corpus.zip $OUT/fuzzgetfloat_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzGetFloat fuzzgetfloat
compile_go_fuzzer github.com/buger/jsonparser FuzzGetFloat fuzzgetfloat

cp corpus.zip $OUT/fuzzgetint_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzGetInt fuzzgetint
compile_go_fuzzer github.com/buger/jsonparser FuzzGetInt fuzzgetint

cp corpus.zip $OUT/fuzzgetboolean_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzGetBoolean fuzzgetboolean
compile_go_fuzzer github.com/buger/jsonparser FuzzGetBoolean fuzzgetboolean

cp corpus.zip $OUT/fuzzgetunsafestring_seed_corpus.zip
compile_fuzzer github.com/buger/jsonparser FuzzGetUnsafeString fuzzgetunsafestring
compile_go_fuzzer github.com/buger/jsonparser FuzzGetUnsafeString fuzzgetunsafestring