Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use built-in fuzz function #217

Merged
merged 1 commit into from Nov 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 14 additions & 24 deletions oss-fuzz-build.sh
@@ -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