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).
22 lines
846 B
Rust
22 lines
846 B
Rust
//! Fuzzes the video (AES-GCM) and audio (AES-CBC) decryption of hostile packets.
|
|
//! Asserts invariants, not only "no panic": random video packets never pass the tag; audio output is shorter than its input, which is whole blocks.
|
|
//! How to run: see the comment at the top of `fuzz/Cargo.toml`.
|
|
|
|
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
use domistream::SessionKeys;
|
|
use domistream::audio::AudioCipher;
|
|
use domistream::video::VideoCipher;
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
if let Ok(p) = VideoCipher::new([0x42; 16]).decrypt(data) {
|
|
panic!("forged video packet accepted: {} bytes", p.len());
|
|
}
|
|
let seq = data.first().map_or(0, |b| u16::from(*b));
|
|
if let Ok(p) = AudioCipher::new(&SessionKeys { rikey: [0x42; 16], rikeyid: 7 }).decrypt(seq, data) {
|
|
assert!(p.len() < data.len() && data.len() % 16 == 0);
|
|
}
|
|
});
|