//! `Command::parse` must never panic on arbitrary `(type_id, payload)` //! input. Accepted commands must respect the OTA payload bound. #![no_main] use arbitrary::Arbitrary; use donglora_protocol::{Command, MAX_OTA_PAYLOAD}; use libfuzzer_sys::fuzz_target; #[derive(Debug, Arbitrary)] struct Input<'a> { type_id: u8, payload: &'a [u8], } fuzz_target!(|input: Input| { if let Ok(Command::Tx { data, .. }) = Command::parse(input.type_id, input.payload) { assert!(data.len() <= MAX_OTA_PAYLOAD); } });