A toy target to show the idea:
int parse(const uint8_t *buf, size_t len) {
if (len >= 4 && buf[0] == 'F' && buf[1] == 'U' &&
buf[2] == 'Z' && buf[3] == 'Z') {
crash_here(); /* the bug */
}
return 0;
}
A blind fuzzer that throws random bytes needs to guess four specific bytes at once: one chance in 2^32 per try, around four billion tries.
A coverage-guided fuzzer instruments the binary and records which branches each input reaches. When a random input happens to start with F, it takes a branch that no input took before, so it is kept in the corpus. The next mutations start from there. Each correct byte is a new branch, so the fuzzer climbs one byte at a time: roughly 256 tries per byte, about a thousand in total. Four billion became a thousand.
The harness is tiny too. With libFuzzer it is just:
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
parse(data, size);
return 0;
}
Build with a sanitizer (-fsanitize=fuzzer,address) so that memory errors turn into crashes right away instead of silent corruption.
That is the whole trick: feedback turns a search through a huge space into a ladder of small steps. The rest (dictionaries, structure-aware mutators, parallel workers) is engineering around that idea.