The Arbitrary crate lets you construct arbitrary instance of a type.
This crate is primarily intended to be combined with a fuzzer like libFuzzer and cargo-fuzz or AFL, and to help you turn the raw, untyped byte buffers that they produce into well-typed, valid, structured values. This allows you to combine structure-aware test case generation with coverage-guided, mutation-based fuzzers.
Learn more:
And the arbitrary crate is approaching 1.0! We've already released two 1.0 release candidates. Now we're asking for your help: Please try out the latest release candidate with your existing fuzz targets (or new ones) and let us know if there is anything that isn't smooth, feels like a regression, etc.
# Update your Cargo.toml to take the release
# candidate for a spin.
[dependencies]
arbitrary = "1.0.0-rc2"
If all goes smoothly, we intend to release 1.0 in two weeks on February 23rd.
CHANGELOG
1.0.0-rc2
Released 2021-02-09.
Added
- The
Arbitrarytrait is now implemented for&[u8]. #67
Changed
- Rename
Unstructured#get_bytestoUnstructured#bytes. #70 - Passing an empty slice of choices to
Unstructured#choosereturns an error. Previously it would panic. 71
1.0.0-rc1
Released 2020-11-25.
Added
- The
Arbitrarytrait is now implemented for&str. #63
Changed
- The
Arbitrarytrait now has a lifetime parameter, allowingArbitraryimplementations that borrow from the raw input (e.g. the new&strimplementaton). Thederive(Arbitrary)macro also supports derivingArbitraryon types with lifetimes now. #63
Removed
-
The
shrinkmethod on theArbitrarytrait has been removed.We have found that, in practice, using internal reduction via approaches like
cargo fuzz tmin, where the raw input bytes are reduced rather than theT: Arbitrarytype constructed from those raw bytes, has the best efficiency-to-maintenance ratio. To the best of our knowledge, no one is relying on or using theArbitrary::shrinkmethod. If you are using and relying on theArbitrary::shrinkmethod, please reach out by dropping a comment here and explaining how you're using it and what your use case is. We'll figure out what the best solution is, including potentially adding shrinking functionality back to thearbitrarycrate.