$ show rust-fuzz/honggfuzz-rs
This repository provides the `honggfuzz` Rust crate, which integrates Google's Honggfuzz fuzzer with Rust. It offers a library with a `fuzz` function and `fuzz!` macro for defining fuzz targets, and two cargo subcommands (`cargo hfuzz` and `cargo honggfuzz`) for building with fuzzing instrumentation and running the fuzzer. The crate handles persistent fuzzing, conditional compilation via `cfg(fuzzing)`, and supports both raw byte slices and structured inputs via the `arbitrary` crate. The build script compiles the Honggfuzz C library from a submodule and links it statically. The codebase is well-structured, with clear separation between the library, CLI tools, and build infrastructure, and demonstrates thoughtful engineering for a security testing tool.
The LLM identified 1 files worth highlighting for reuse:
The core library providing the `fuzz` function and `fuzz!` macro. It demonstrates a reusable pattern for persistent fuzzing: the macro abstracts over input types (raw bytes or arbitrary types), handles panic hooks to abort before unwinding for crash deduplication, and uses conditional compilation to provide a no-op fallback when not built with fuzzing instrumentation. The design is clean and could be adapted for other fuzzers by replacing the FFI call to `HF_ITER`.