From 91e148cbb322e8d22aeca84d70be86eb058233fa Mon Sep 17 00:00:00 2001 From: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com> Date: Sat, 13 Aug 2022 19:20:20 +0100 Subject: [PATCH] golang: build upstream fuzzers (#8245) Signed-off-by: AdamKorcz Signed-off-by: AdamKorcz --- projects/golang/build.sh | 47 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/projects/golang/build.sh b/projects/golang/build.sh index 0ed0f5318..6da200be1 100755 --- a/projects/golang/build.sh +++ b/projects/golang/build.sh @@ -47,16 +47,32 @@ compile_go_fuzzer $FUZZ_ROOT/xml Fuzz xml_fuzzer compile_go_fuzzer $FUZZ_ROOT/zip Fuzz zip_fuzzer compile_go_fuzzer $FUZZ_ROOT/zlib Fuzz zlib_fuzzer +cd $SRC/go/src/archive/tar +go mod init tarPackage +go mod tidy +find . -name "*_test.go" ! -name 'fuzz_test.go' -type f -exec rm -f {} + +go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes +go get github.com/AdamKorcz/go-118-fuzz-build/utils +compile_native_go_fuzzer tarPackage FuzzReader fuzz_std_lib_tar_reader + cd $SRC && git clone https://github.com/AdamKorcz/instrumentation cd instrumentation go run main.go $SRC/go/src/archive/tar cd $SRC/go/src/archive/tar cp $SRC/fuzz_tar_reader.go ./ -go mod init tarPackage rm ./*_test.go compile_go_fuzzer tarPackage FuzzTarReader fuzz_tar_reader +mv $SRC/fuzz_tar_reader.options $OUT/ + +cd $SRC/go/src/archive/zip +go mod init zipPackage +go mod tidy +find . -name "*_test.go" ! -name 'fuzz_test.go' -type f -exec rm -f {} + +go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes +go get github.com/AdamKorcz/go-118-fuzz-build/utils +compile_native_go_fuzzer zipPackage FuzzReader fuzz_std_lib_zip_reader cd $SRC/go/src/internal/saferio go mod init saferioPackage @@ -72,4 +88,31 @@ rm ./*_test.go compile_go_fuzzer elfPackage FuzzElfOpen fuzz_elf_open zip $OUT/fuzz_elf_open_seed_corpus.zip ./testdata/* -mv $SRC/fuzz_tar_reader.options $OUT/ \ No newline at end of file +cd $SRC/go/src/image/png +go mod init pngPackage +go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes +go get github.com/AdamKorcz/go-118-fuzz-build/utils +compile_native_go_fuzzer pngPackage FuzzDecode fuzz_png_decode +zip $OUT/fuzz_png_decode_seed_corpus.zip ./testdata/*.png + +cd $SRC/go/src/image/gif +go mod init gifPackage +go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes +go get github.com/AdamKorcz/go-118-fuzz-build/utils +compile_native_go_fuzzer gifPackage FuzzDecode fuzz_gif_decode +zip $OUT/fuzz_gif_decode_seed_corpus.zip $SRC/go/src/image/testdata/*.gif + +cd $SRC/go/src/compress/gzip +go mod init gzipPackage +go mod tidy +find . -name "*_test.go" ! -name 'fuzz_test.go' -type f -exec rm -f {} + +go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes +go get github.com/AdamKorcz/go-118-fuzz-build/utils +compile_native_go_fuzzer gzipPackage FuzzReader fuzz_std_lib_gzip_reader + +cd $SRC/go/src/html +go mod init htmlPackage +go mod tidy +go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes +go get github.com/AdamKorcz/go-118-fuzz-build/utils +compile_go_fuzzer htmlPackage Fuzz fuzz_html_escape_unescape