//! Fuzzes `/launch` and `/resume` answers. //! Asserts invariants, not only "no panic": a session URL is within the cap, starts with rtsp:// and has no control characters. //! How to run: see the comment at the top of `fuzz/Cargo.toml`. #![no_main] use libfuzzer_sys::fuzz_target; use domistream::http::launch::{MAX_LAUNCH_RESPONSE_BYTES, MAX_SESSION_URL_BYTES}; fuzz_target!(|data: &[u8]| { let r = domistream::http::parse_launch_response(data); if data.len() > MAX_LAUNCH_RESPONSE_BYTES { assert!(matches!(r, Err(domistream::Error::TooLarge { .. }))); } if let Ok(l) = r { if let Some(url) = l.session_url { assert!(url.len() <= MAX_SESSION_URL_BYTES); assert!(url.starts_with("rtsp://")); assert!(!url.chars().any(char::is_control)); } } });