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,
|
||||
);
|
||||
}
|
||||
});
|
||||
6
fuzz/fuzz_targets/frame_decode.rs
Normal file
6
fuzz/fuzz_targets/frame_decode.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let _ = dd3_protocol::decode_frame(data, dd3_protocol::MsgKind::AckDown as u8);
|
||||
});
|
||||
6
fuzz/fuzz_targets/payload_decode_v3.rs
Normal file
6
fuzz/fuzz_targets/payload_decode_v3.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let _ = dd3_protocol::decode_batch_v3(data);
|
||||
});
|
||||
8
fuzz/fuzz_targets/sanitize_device_id.rs
Normal file
8
fuzz/fuzz_targets/sanitize_device_id.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(s) = core::str::from_utf8(data) {
|
||||
let _ = dd3_contracts::sanitize_device_id(s);
|
||||
}
|
||||
});
|
||||
8
fuzz/fuzz_targets/url_encode_component.rs
Normal file
8
fuzz/fuzz_targets/url_encode_component.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(s) = core::str::from_utf8(data) {
|
||||
let _ = dd3_contracts::url_encode_component(s);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user