//! 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); } });