Course contentsShow
← Software Engineering
Lesson 622 of 1,93319. Property-Based and Fuzz TestingFree lesson

Coverage-Guided Fuzzing

Modern fuzzers use code coverage feedback to guide input generation toward unexplored code paths and edge cases.

Coverage-Guided Fuzzing

You'll learn how modern fuzzers use code coverage feedback to intelligently explore program behavior rather than blindly generating random inputs.

The Core Idea

Traditional fuzzing (as you learned in the previous lesson) generates random inputs and throws them at your program to find crashes. Coverage-guided fuzzing is smarter: it monitors which parts of your code each input reaches, then evolves inputs that discover new code paths. Think of it as breadcrumb-following—the fuzzer keeps inputs that lead somewhere new and mutates them further to explore deeper.

How It Works

When a coverage-guided fuzzer runs:

  1. It generates an initial input and executes your program
  2. It records which lines, branches, or basic blocks were executed (using coverage metrics you learned earlier)
  3. If this input reached new code that previous inputs didn't, it's saved to a corpus
  4. The fuzzer mutates these "interesting" inputs to try reaching even more unexplored code
  5. Inputs that don't discover new coverage are typically discarded

This creates a feedback loop: new coverage → save input → mutate → discover more coverage.

Why This Matters

Without coverage guidance, a fuzzer might generate millions of similar inputs that all exercise the same code path. With coverage feedback, the fuzzer acts like an explorer mapping unknown territory—it prioritizes paths that lead somewhere it hasn't been. This dramatically improves the fuzzer's ability to find edge cases hiding in rarely-executed code branches.

The fuzzer essentially automates the "coverage-guided test writing" strategy you learned, but at machine scale and speed.

Key Takeaway:
Coverage-guided fuzzing uses execution feedback to evolve inputs toward unexplored code paths, making fuzzing exponentially more effective at discovering edge cases than blind random generation.