948f446a13
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).
23 lines
805 B
Rust
23 lines
805 B
Rust
//! Fuzzes RTSP responses.
|
|
//! Asserts invariants, not only "no panic": header count, line length and body within the caps.
|
|
//! How to run: see the comment at the top of `fuzz/Cargo.toml`.
|
|
|
|
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
use domistream::rtsp::{MAX_RTSP_HEADERS, MAX_RTSP_LINE_BYTES, MAX_RTSP_MESSAGE_BYTES};
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
let r = domistream::rtsp::parse_response(data);
|
|
if data.len() > MAX_RTSP_MESSAGE_BYTES {
|
|
assert!(matches!(r, Err(domistream::Error::TooLarge { .. })));
|
|
}
|
|
if let Ok(m) = r {
|
|
assert!(m.headers.len() <= MAX_RTSP_HEADERS);
|
|
assert!(m.reason.len() <= MAX_RTSP_LINE_BYTES);
|
|
assert!(m.headers.iter().all(|(k, v)| k.len() + v.len() <= MAX_RTSP_LINE_BYTES));
|
|
assert!(m.body.len() <= data.len());
|
|
}
|
|
});
|