forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

parse_metadata.rs20 lines, 719 bytesHistoryRawDownload
1#![no_main]
2
3use ec_flac::{FlacReader, StreamInfo};
4use libfuzzer_sys::fuzz_target;
5
6// Metadata only: the STREAMINFO payload on its own, and the whole stream opened
7// as a reader (magic, metadata blocks, seek table), with a seek on the result.
8fuzz_target!(|data: &[u8]| {
9 if let Ok(info) = StreamInfo::parse(data) {
10 // Every field is a bit-exact slice of the 34 bytes, so packing back must
11 // reproduce them.
12 assert_eq!(info.to_bytes()[..], data[..34]);
13 }
14 if let Ok(mut reader) = FlacReader::new(data) {
15 let _ = reader.stream_info();
16 let _ = reader.seek_table();
17 let _ = reader.seek_to_sample(0);
18 let _ = reader.seek_to_sample(u64::MAX);
19 }
20});