> Right now, on start-up, go-fuzz re-runs all existing corpus entries.
> However, it also tries to re-minimize them at the same time, which is
> slow. This is useful if you're going to fuzz for a while. If you're
> just going to fuzz for a few seconds, though (or not at all, if you're
> only testing the existing entries), this is unhelpful. On the other
> hand, this re-minimization is helpful when the underlying instrumented
> code changes, as it will.
> What is the right way to handle this?
Here is a possible alternative to tracking explicit state or computing a hash of the code to see if it has changed, etc.
One way to handle the question might be to take the time spent so far as a hint.
If someone fuzzes for 10 seconds, they probably are looking for a quick test and don't want to spend time on minimizing.
On the other hand, if someone is fuzzing for multiple hours, they would benefit from the online minimization having happened.
So simple but maybe "effective enough" logic could be to pick a duration somewhere in-between those two extremes (say, maybe 30 seconds? 60 seconds?).
A fuzzing run such as `go test -fuzz=FuzzFunc some/pkg` could then start by:
1. run through all the input corpus, but don't do the online minimization
2. start mutating inputs
3. after 60 seconds, do the online minimization (more-or-less guessing it is worthwhile to settle in for a longer fuzzing session), and continue from there.
Regards,
thepudds