Hi there,
Just a quick comment that the fzgo prototype now supports fuzzing rich signatures such as:
func FuzzRegexRichArgs(re string, input []byte, posix bool) (bool, error)
which you can then fuzz via:
fzgo test -fuzz=FuzzRegexRichArgs
The way it works is when fzgo is asked to fuzz a set of functions, it checks each function to see if it a rich signature (that is, not a classic 'Fuzz([]byte) int' signature).
If it finds a rich signature, such as in the example above, fzgo behind the scenes automatically generates a wrapper that creates random values for the rich parameters based on a []byte handed in by dvyukov/go-fuzz. There is a fzgo.randparam package that is built on top of
github.com/google/gofuzz. fzgo.randparam has some more control of the randomness to more directly pull values from the []byte from dvyukov/go-fuzz (mainly so that dvyukov/go-fuzz literal injection works end-to-end, which wouldn't work if just directly using
github.com/google/gofuzz, as well as in order to not waste as many input bytes in the original []byte handed in, and to control what happens when you run out of bytes in the input []byte, etc.).
Once the fuzzing starts, dvyukov/go-fuzz is still in charge, including the recorded corpus stores the serialized arguments that were used to fuzz the rich signatures, and dvyukov/go-fuzz still does its genetic mutations, etc.
For example, this gets guessed within a few seconds of fuzzing:
func FuzzHardToGuessNumber(guessMe int64, list []string) {
if guessMe == 0x123456789 {
panic("bingo")
}
}
The rich signature support in fzgo is still at an early stage, but it seems to work, and it is fun!
It only fills in public struct elements, and can't automatically fill in interfaces or a passed-in func pointer, but it should handle a decent variety of rich signatures.
FWIW, I think supporting rich signatures is really the killer feature of the proposal.
More than anything, I think cmd/go supporting rich signatures for fuzzing moves it from "Hmm, fuzzing sounds interesting to do someday" to instead being something that is much more natural to get started with, and more akin to unit tests.
That said, it is likely still very reasonable for the official proposal to say that support for rich signatures is a desired future direction rather than required for the first version, which is more-or-less what I think the proposal says now. (Incremental progress, and all that).
Separately, I am hopefully about to post in some of the other fuzz proposal threads a little later today with some other questions/comments, as well as I am going to try to post an updated at least partial list of open questions regarding the proposal.
Regards,
thepudds