#![no_main] //! Fuzz the wire-packet decoder + decrypt path. //! //! Mirrors tests/parser_robustness.rs but driven by libFuzzer so the coverage //! engine can search for panics in `protocol::decode`, `Header::parse`, and the //! decode -> decrypt_body pipeline. The objective is: NO PANICS on any input. use libfuzzer_sys::fuzz_target; use dosh::protocol::{self, CLIENT_TO_SERVER, SERVER_TO_CLIENT}; fuzz_target!(|data: &[u8]| { // Header parsing must never panic. let _ = protocol::Header::parse(data); // Full decode, then attempt decryption with a fixed key in both directions. // A real attacker controls these bytes; neither path may panic. if let Ok(packet) = protocol::decode(data) { let key = [0x42u8; 32]; let _ = protocol::decrypt_body(&packet, &key, CLIENT_TO_SERVER); let _ = protocol::decrypt_body(&packet, &key, SERVER_TO_CLIENT); } });