forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

parse_toc.rs21 lines, 640 bytesHistoryRawDownload
1#![no_main]
2
3// The whole input is one Opus packet: its first byte is the TOC, the rest the frame data.
4// Exercises the TOC accessors and both packet framings (plain and self-delimited).
5
6use ec_opus::{Packet, Toc};
7use libfuzzer_sys::fuzz_target;
8
9fuzz_target!(|data: &[u8]| {
10 let Some(&toc_byte) = data.first() else {
11 return;
12 };
13 let toc = Toc::new(toc_byte);
14 let _ = (toc.mode(), toc.bandwidth(), toc.frame_size_48k(), toc.channels());
15 if let Ok(p) = Packet::parse(data, false) {
16 let _ = p.samples_48k();
17 }
18 if let Ok(p) = Packet::parse(data, true) {
19 let _ = p.samples_48k();
20 }
21});