//! Untrusted decrypted plaintext against the application dispatch classifier. //! //! `dispatch::classify` runs on every inbound message before anything else //! looks at it, and its `Ratchet` arm is what routes a `rat `-prefixed message //! into the ratchet parser (`src/ratchet.rs` `Frame::parse`). It takes raw //! bytes — never a `&str` — so all 255 byte values are in scope, and it must //! classify (or `Drop`) every input without panicking. #![no_main] use libfuzzer_sys::fuzz_target; use onionwire::dispatch::{self, Kind}; fuzz_target!(|data: &[u8]| { let kind = dispatch::classify(data); // Total and deterministic: every input maps to exactly one variant, and the // answer is stable across calls (no interior state, no ordering dependence). assert_eq!(kind, dispatch::classify(data)); // The routing invariant that matters: the `rat ` prefix is never shadowed by // the `[a-z]{3} ` catch-all, so a ratchet frame always reaches the ratchet // parser rather than being dropped as an unknown prefix. if data.starts_with(b"rat ") { assert_eq!(kind, Kind::Ratchet); } });