d5917e7aab
road_file: any bytes as one road file in the home store. The parser never panics; a road that parses renders to canonical text that parses back to the same road and rendering is a fixed point; compile never panics; and a file that does not parse, or a road the compiler reports an error for, leaves every plan byte-identical (deny by default). envelope: Envelope::decode never panics; whatever it accepts re-encodes, decodes to the same envelope and encodes stably. Own workspace, as cargo fuzz lays it out. On Windows with the stable MSVC toolchain and no sanitizer, build.rs links win_sections.c, which gives the SanitizerCoverage counters their COFF section bounds (compiler-rt only ships them inside a sanitizer runtime); the exact command is in road_file.rs.
19 lines
656 B
Rust
19 lines
656 B
Rust
//! Fuzzes the control-protocol decoder (QA review of PR #1): `Envelope::decode` never panics, and anything it
|
|
//! accepts encodes to bytes that decode to the same envelope, and encoding is stable.
|
|
//!
|
|
//! Run: RUSTC_BOOTSTRAP=1 cargo fuzz run envelope -s none -- -max_total_time=300
|
|
|
|
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
use proto::Envelope;
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
if let Ok(env) = Envelope::decode(data) {
|
|
let bytes = env.encode();
|
|
let again = Envelope::decode(&bytes).expect("an encoded envelope decodes");
|
|
assert_eq!(again, env);
|
|
assert_eq!(again.encode(), bytes, "encoding is not stable");
|
|
}
|
|
});
|