cargo-fuzz

Automate fuzz testing for Rust projects with cargo-fuzz and libFuzzer.

Updated Jul 10, 2025
One-click install
npx skills add https://github.com/Superlend/superloop-core-contracts --skill cargo-fuzz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cargo-fuzz
Source: https://github.com/Superlend/superloop-core-contracts/tree/main/.cursor/skills/testing-handbook-skills/skills/cargo-fuzz
Command: npx skills add https://github.com/Superlend/superloop-core-contracts --skill cargo-fuzz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fuzz testing is essential for Rust projects to uncover security and reliability issues early. cargo-fuzz simplifies this by integrating libFuzzer with Cargo, automating build flags, harness setup, and test execution.

Core Features & Use Cases

  • Integrated fuzzing workflow: cargo-fuzz provides a Cargo-based interface to run fuzz targets with libFuzzer.
  • Harness and corpus management: Create and organize fuzz targets and seed corpora under fuzz/corpus.
  • Sanitizer and coverage support: Supports AddressSanitizer and coverage tooling for robust diagnostics.
  • Use cases: Use cargo-fuzz to harden libraries, validators, parsers, and protocols by discovering edge-case inputs.

Quick Start

Install nightly Rust toolchain, install cargo-fuzz, initialize fuzzing with cargo fuzz init, create a fuzz target under fuzz/fuzz_targets, and run fuzz with cargo +nightly fuzz run <target>.

Frequently Asked Questions about cargo-fuzz

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up fuzz testing for a Rust project?

Fuzz testing for a Rust project requires initializing targets with cargo fuzz init, creating targets under fuzz/fuzz_targets, and running them using cargo +nightly fuzz run <target> to discover edge-case inputs.

What is fuzzing with libFuzzer used for in Rust?

Fuzzing with libFuzzer in Rust is used to harden libraries, validators, parsers, and protocols by discovering edge-case inputs that uncover security and reliability issues early in development.

Do I need the nightly Rust toolchain to run cargo-fuzz?

Yes, the nightly Rust toolchain is required to run cargo-fuzz. You must install nightly Rust and execute fuzzing commands using cargo +nightly fuzz run to apply sanitizer and coverage support.

How do I manage seed corpora and fuzz targets in Rust?

Manage seed corpora and fuzz targets by creating and organizing them under the fuzz/corpus directory and fuzz/fuzz_targets path, enabling structured test execution and corpus management.

Does cargo-fuzz support AddressSanitizer and coverage reporting?

Yes, cargo-fuzz supports AddressSanitizer and coverage tooling for robust diagnostics, enabling developers to detect memory errors and generate coverage reports during fuzz testing.

What are the limitations of using cargo-fuzz for Rust fuzzing?

Limitations of cargo-fuzz include its strict dependency on the nightly Rust toolchain and the cargo-fuzz tool, meaning it cannot run on stable Rust or without proper target and corpus initialization.