Skip to content

Latest commit

 

History

History
executable file
·
28 lines (23 loc) · 1.7 KB

06.1.md

File metadata and controls

executable file
·
28 lines (23 loc) · 1.7 KB

Go-Fuzz Quickstart

  1. Get Go-fuzz with go get github.com/dvyukov/go-fuzz.
  2. 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
  3. Get the target package and store it in GOPATH. I usually keep it under src\github.com\author\project.
  4. Create a new file in the target package named Fuzz.go.
  5. Create a function named Fuzz inside Fuzz.go with this signature func Fuzz(data []byte) int.
  6. Fuzz should return 1 if input is good and 0 otherwise.
  7. Create fuzzing directory, e.g. go-fuzz-project-name.
  8. go-fuzz-build github.com/author/project (note forward slashes even on Windows). Copy the resulting file (project-fuzz.zip) to the fuzzing directory.
  9. Make a directory called corpus and store samples there.
  10. go-fuzz -bin=project-fuzz.zip -workdir=. to begin fuzzing.

Examples