//! 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"); } });