Skip to content

Commit

Permalink
fuzzer: do runtime nil check for args, instead of older emitted nil c…
Browse files Browse the repository at this point in the history
…hecks
  • Loading branch information
thepudds authored Dec 16, 2021
2 parents 1c377fb + e427c90 commit 25f8f0c
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 1,863 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ $ go install golang.org/dl/gotip@latest
$ gotip download
```

Download, compile, and install the fzgen binary from source:
Download and install the fzgen binary from source, as well as add its fuzzer to our go.mod:
```
$ go install github.com/thepudds/fzgen/cmd/fzgen@latest
$ go get github.com/thepudds/fzgen/fuzzer
```

Use fzgen to automatically create a set of fuzz targets -- in this case for the encoding/ascii85 package from the Go standard library:
Expand Down Expand Up @@ -56,10 +57,10 @@ That's enough for you to get started on your own, but let's also briefly look at

## Example: Easily Finding a Data Race

Again starting from an empty directory, we'll set up a module, and this time also add fzgen to the go.mod:
Again starting from an empty directory, we'll set up a module, and add the fzgen fuzzer to go.mod:
```
$ go mod init temp
$ go get go get github.com/thepudds/fzgen
$ go get github.com/thepudds/fzgen/fuzzer
```

Next, we automatically create a new fuzz target. This time:
Expand Down
15 changes: 0 additions & 15 deletions examples/inputs/race-xsync-mpmcqueue/go.mod

This file was deleted.

49 changes: 0 additions & 49 deletions examples/inputs/race-xsync-mpmcqueue/go.sum

This file was deleted.

33 changes: 0 additions & 33 deletions examples/inputs/race-xsync-mpmcqueue/xsyncqueue.go

This file was deleted.

4 changes: 2 additions & 2 deletions examples/inputs/race/race.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// 3. The two Loads must happen concurrently.
// 4. Prior to the two Loads, no other Store can update the key to have a non-matching payload.
//
// Using the fzgen/fuzzer.Chain created by default via 'fzgen -chain -parallel -pkg=github.com/thepudds/fzgen/examples/inputs/race',
// Using the fzgen/fuzzer.Chain created by default via 'fzgen -chain -parallel github.com/thepudds/fzgen/examples/inputs/race',
// this data race is typically caught after a few minutes of fuzzing with '-race' when starting from scratch.
package raceexample

Expand All @@ -32,7 +32,7 @@ func (m *MySafeMap) Load(key [16]byte) *Request {
if ok {
req := r.(*Request)
if req.Answer == 42 {
// DATA RACE (but requires: matching store/load keys, and concurrent matching load keys, and certain payload data)
// DATA RACE (but detection requires: matching store/load keys, and concurrent matching load keys, and certain payload data)
req.deepQuestion++
}
return req
Expand Down
24 changes: 0 additions & 24 deletions examples/outputs/go-fuzz-perf/cmd-go/fuzz_test.go

This file was deleted.

52 changes: 0 additions & 52 deletions examples/outputs/go-fuzz-perf/go-fuzz/fuzz.go

This file was deleted.

101 changes: 0 additions & 101 deletions examples/outputs/goroar/autofuzzchain_test.go

This file was deleted.

Loading

0 comments on commit 25f8f0c

Please sign in to comment.