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).
24 lines
866 B
Rust
24 lines
866 B
Rust
//! Fuzzes decrypted control messages from the host.
|
|
//! Asserts invariants, not only "no panic": the split matches the length field; a host message always splits as a message; Other keeps the body length.
|
|
//! How to run: see the comment at the top of `fuzz/Cargo.toml`.
|
|
|
|
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
use domistream::control::{HostMessage, parse_host_message, parse_message};
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
let raw = parse_message(data);
|
|
if let Ok(r) = raw {
|
|
assert_eq!(r.body.len() + 4, data.len());
|
|
assert_eq!(r.message_type, u16::from_le_bytes([data[0], data[1]]));
|
|
}
|
|
if let Ok(m) = parse_host_message(data) {
|
|
assert!(raw.is_ok(), "a host message must split as a message first");
|
|
if let HostMessage::Other { body_len, .. } = m {
|
|
assert_eq!(body_len + 4, data.len());
|
|
}
|
|
}
|
|
});
|