Bootstrap DD3 Rust port workspace with host-first compatibility tests
This commit is contained in:
35
fuzz/fuzz_targets/chunk_stream_ingest.rs
Normal file
35
fuzz/fuzz_targets/chunk_stream_ingest.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let mut state = dd3_protocol::ReassemblyState::default();
|
||||
let mut buffer = [0u8; 4096];
|
||||
|
||||
let mut pos = 0usize;
|
||||
while pos + 7 <= data.len() {
|
||||
let batch_id = u16::from_le_bytes([data[pos], data[pos + 1]]);
|
||||
let idx = data[pos + 2];
|
||||
let cnt = data[pos + 3];
|
||||
let total_len = u16::from_le_bytes([data[pos + 4], data[pos + 5]]);
|
||||
let chunk_len = data[pos + 6] as usize;
|
||||
pos += 7;
|
||||
if pos + chunk_len > data.len() {
|
||||
break;
|
||||
}
|
||||
let chunk = &data[pos..pos + chunk_len];
|
||||
pos += chunk_len;
|
||||
|
||||
let _ = dd3_protocol::push_chunk(
|
||||
&mut state,
|
||||
batch_id,
|
||||
idx,
|
||||
cnt,
|
||||
total_len,
|
||||
chunk,
|
||||
0,
|
||||
5000,
|
||||
4096,
|
||||
&mut buffer,
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user