[domistream] Tests: fuzz targets assert invariants

Every target now checks properties instead of only calling the parser:
parse -> encode -> parse stability (RTSP request, ENet, input), caps and
TooLarge past them, chunking invariance of the framer, XML vs status parser
agreement, seal/open round trips, no forged GCM tags. New targets for the
parsers and state machines that had none: server_cert_der, enet_client,
media_decrypt, video_depacketizer, audio_depacketizer, fec_reconstruct,
pairing_session, rtsp_client (25 targets).
This commit is contained in:
2026-11-25 12:51:08 +01:00
parent 71e34e8d9d
commit 948f446a13
26 changed files with 636 additions and 63 deletions
+15 -3
View File
@@ -1,11 +1,23 @@
//! Fuzzes `/launch` and `/resume` answers: never panics, whatever the bytes.
//! Phase A: the parser returns `Unimplemented`; QA adds the properties (round trips, caps) with the logic.
//! 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 _ = domistream::http::parse_launch_response(data);
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));
}
}
});