From d8bc21f7e13fa476be55b17983bd5d43ad8c7121 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 14 Apr 2020 15:46:43 -0700 Subject: [PATCH] internal/fuzz: update to use native go-fuzz Fixes golang/protobuf#1084. Change-Id: I2c71e9f58d09345d13f461ec78ee4e39c3a7f06d Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/228277 Reviewed-by: Joe Tsai --- internal/fuzz/README.md | 5 +++-- internal/fuzz/oss-fuzz-build.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/fuzz/README.md b/internal/fuzz/README.md index fc211c1b..62793fe4 100644 --- a/internal/fuzz/README.md +++ b/internal/fuzz/README.md @@ -5,9 +5,10 @@ Fuzzing support using [go-fuzz](https://github.com/dvyukov/go-fuzz). Basic operation: ```sh -$ go install github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build +$ go install github.com/dvyukov/go-fuzz/go-fuzz +$ go install github.com/mdempsky/go114-fuzz-build $ cd internal/fuzz/{fuzzer} -$ GOFUZZ111MODULE=on go-fuzz-build . +$ go114-fuzz-build google.golang.org/protobuf/internal/fuzz/{fuzzer} $ go-fuzz ``` diff --git a/internal/fuzz/oss-fuzz-build.sh b/internal/fuzz/oss-fuzz-build.sh index ad3ffd79..0953101e 100644 --- a/internal/fuzz/oss-fuzz-build.sh +++ b/internal/fuzz/oss-fuzz-build.sh @@ -10,7 +10,7 @@ function compile_fuzzer { fuzzer=$3 # Instrument all Go files relevant to this fuzzer - go-fuzz-build -tags=protolegacy -libfuzzer -func $function -o $fuzzer.a $path + go-fuzz -tags=protolegacy -func $function -o $fuzzer.a $path # Instrumented, compiled Go ($fuzzer.a) + fuzzing engine = fuzzer binary $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o $OUT/$fuzzer @@ -19,7 +19,7 @@ function compile_fuzzer { for x in internal/fuzz/*; do if [ -d $x/corpus ]; then name=$(basename $x) - compile_fuzzer ./$x Fuzz $name + compile_fuzzer google.golang.org/protobuf/$x Fuzz $name zip -jr $OUT/${name}_seed_corpus.zip $x/corpus fi done