-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use built-in fuzz function
- Loading branch information
Showing
1 changed file
with
14 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|