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).
25 lines
933 B
Rust
25 lines
933 B
Rust
//! Fuzzes audio packets.
|
|
//! Asserts invariants, not only "no panic": payload types and shard indices are the ones PROTOCOL.md allows; payloads are never empty.
|
|
//! How to run: see the comment at the top of `fuzz/Cargo.toml`.
|
|
|
|
#![no_main]
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
use domistream::audio::AudioPacket;
|
|
use domistream::audio::packet::{AUDIO_FEC_PAYLOAD_TYPE, AUDIO_PAYLOAD_TYPE, MAX_AUDIO_PACKET_BYTES};
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
match domistream::audio::parse_audio_packet(data) {
|
|
Ok(AudioPacket::Data { rtp, payload }) => {
|
|
assert_eq!(rtp.payload_type, AUDIO_PAYLOAD_TYPE);
|
|
assert!(!payload.is_empty() && data.len() <= MAX_AUDIO_PACKET_BYTES);
|
|
}
|
|
Ok(AudioPacket::Parity { rtp, fec, parity }) => {
|
|
assert_eq!(rtp.payload_type, AUDIO_FEC_PAYLOAD_TYPE);
|
|
assert!(fec.shard_index <= 1 && !parity.is_empty());
|
|
}
|
|
Err(_) => {}
|
|
}
|
|
});
|