How it works...
The github.com/dvyukov/go-fuzz package uses evolutionary algorithms to build a corpus of inputs in order to test Go code. In our case, we introduced an intentional panic in order to demonstrate the behavior when a crash is found. Fuzzing is a practical way to find unexpected panics, especially when doing programming handling array bounds or arbitrary input.
When fuzzing an application, on of the most difficult parts is writing an appropriate fuzz function. The go-fuzz application will adapt based on the responses from this function. If your fuzz function returns 1, it considered a successful input. If -1 is returned, the item will not be included in the corpus, and if 0 is returned, it's given lower priority. We can change ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access