[repo] Fuzz: one libFuzzer target per parser, own workspace, Windows MSVC setup from Via
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//! Fuzzes the RTSP framer over a chunked byte stream: never panics, whatever the bytes.
|
||||
//! Phase A: the parser returns `Unimplemented`; QA adds the properties (round trips, caps) with the logic.
|
||||
//! How to run: see the comment at the top of `fuzz/Cargo.toml`.
|
||||
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
// First byte picks the chunk size, so libFuzzer explores message boundaries across pushes.
|
||||
let Some((&chunk, rest)) = data.split_first() else { return };
|
||||
let chunk = usize::from(chunk).max(1);
|
||||
let mut framer = domistream::rtsp::RtspFramer::new();
|
||||
for piece in rest.chunks(chunk) {
|
||||
if framer.push(piece).is_err() {
|
||||
return;
|
||||
}
|
||||
while let Ok(Some(message)) = framer.next_message() {
|
||||
let _ = domistream::rtsp::parse_response(&message);
|
||||
}
|
||||
}
|
||||
let _ = framer.finish();
|
||||
});
|
||||
Reference in New Issue
Block a user