tgrep uses cargo-fuzz with
libFuzzer for fuzz testing.
cargo install cargo-fuzz| Target | What it fuzzes |
|---|---|
fuzz_trigram |
Trigram extraction, mask generation, binary detection |
fuzz_query |
Regex → query plan decomposition (arbitrary patterns) |
fuzz_ondisk |
On-disk format encode/decode roundtrips |
fuzz_reader |
IndexReader against arbitrary lookup.bin/index.bin/files.bin bytes |
cd fuzz
# Run a specific target
cargo fuzz run fuzz_trigram
cargo fuzz run fuzz_query
cargo fuzz run fuzz_ondisk
cargo fuzz run fuzz_reader
# Run with a time limit (e.g., 60 seconds)
cargo fuzz run fuzz_trigram -- -max_total_time=60
# List all targets
cargo fuzz list- Requires a nightly Rust toolchain:
rustup install nightly cargo fuzzautomatically uses nightly when invoked- Crash inputs are saved to
fuzz/artifacts/<target>/ - Corpus is saved to
fuzz/corpus/<target>/for incremental fuzzing