[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:
@@ -1,5 +1,5 @@
|
||||
//! Fuzzes the RTP header: never panics, whatever the bytes.
|
||||
//! Phase A: the parser returns `Unimplemented`; QA adds the properties (round trips, caps) with the logic.
|
||||
//! Fuzzes the RTP header.
|
||||
//! Asserts invariants, not only "no panic": success means at least 12 bytes and version 2, with the fields read big-endian from the bytes.
|
||||
//! How to run: see the comment at the top of `fuzz/Cargo.toml`.
|
||||
|
||||
#![no_main]
|
||||
@@ -7,5 +7,11 @@
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let _ = domistream::rtp::parse_rtp_header(data);
|
||||
if let Ok(h) = domistream::rtp::parse_rtp_header(data) {
|
||||
assert!(data.len() >= domistream::rtp::RTP_HEADER_LEN);
|
||||
assert_eq!(h.flags >> 6, 2);
|
||||
assert_eq!(h.flags, data[0]);
|
||||
assert_eq!(h.sequence, u16::from_be_bytes([data[2], data[3]]));
|
||||
assert_eq!(h.timestamp, u32::from_be_bytes([data[4], data[5], data[6], data[7]]));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user