mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-17 01:12:51 +00:00
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 <joetsai@google.com>
This commit is contained in:
parent
5e85542f16
commit
d8bc21f7e1
@ -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
|
||||
```
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user