| 1 | This is an explanation of how to do fuzzing of ParseData. This uses github.com/dvyukov/go-fuzz/ for fuzzing. |
| 2 | |
| 3 | # How to use |
| 4 | First, get go-fuzz |
| 5 | ``` |
| 6 | $ go get github.com/dvyukov/go-fuzz/go-fuzz |
| 7 | $ go get github.com/dvyukov/go-fuzz/go-fuzz-build |
| 8 | ``` |
| 9 | |
| 10 | Build the test program by calling the following command |
| 11 | (assuming you have files for pprof located in github.com/google/pprof within go's src folder) |
| 12 | |
| 13 | ``` |
| 14 | $ go-fuzz-build github.com/google/pprof/fuzz |
| 15 | ``` |
| 16 | The above command will produce pprof-fuzz.zip |
| 17 | |
| 18 | |
| 19 | Now you can run the fuzzer by calling |
| 20 | |
| 21 | ``` |
| 22 | $ go-fuzz -bin=./pprof-fuzz.zip -workdir=fuzz |
| 23 | ``` |
| 24 | |
| 25 | This will save a corpus of files used by the fuzzer in ./fuzz/corpus, and |
| 26 | all files that caused ParseData to crash in ./fuzz/crashers. |
| 27 | |
| 28 | For more details on the usage, see github.com/dvyukov/go-fuzz/ |
| 29 | |
| 30 | # About the to corpus |
| 31 | |
| 32 | Right now, fuzz/corpus contains the corpus initially given to the fuzzer |
| 33 | |
| 34 | If using the above commands, fuzz/corpus will be used to generate the initial corpus during fuzz testing. |
| 35 | |
| 36 | One can add profiles into the corpus by placing these files in the corpus directory (fuzz/corpus) |
| 37 | prior to calling go-fuzz-build. |