Quickstart
- Get Go-fuzz by
go get github.com/dvyukov/go-fuzz
. - Build and install
go-fuzz
and go-fuzz-build
.cd src\github.com\dvyukov\go-fuzz\go-fuzz
go install
cd ..\go-fuzz-build
go install
- Get the target package and store it in
GOPATH
. I usually keep it under src\github.com\author\project
. - Create a new file in the target package named
Fuzz.go
. - Create a function named
Fuzz
inside Fuzz.go
with this signature func Fuzz(data []byte) int
. Fuzz
should return 1
if input is good and 0
otherwise.- Create fuzzing directory, e.g.
go-fuzz-project-name
. go-fuzz-build github.com/author/project
(note forward slashes even on Windows). Copy the resulting file (project-fuzz.zip
) to the fuzzing directory.- Make a directory called
corpus
and store samples there. go-fuzz -bin=project-fuzz.zip -workdir=.
to begin fuzzing.
Links