Files
kestrove-desktop/src-tauri/fuzz/fuzz_targets/frame_read.rs
T
samiandClaude Opus 5.5 21ff829405 Fuzz the native-messaging framing and the broker's pairing protocol
src-tauri/fuzz: nmh_session drives a whole kestrove-nmh connection through
Broker::serve (framing, outer JSON, pair_init/pair_confirm/open/msg); frame_read
checks read_frame. 8 min each (2.5 M / 2.7 M execs): no findings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 00:53:36 +09:00

20 lines
679 B
Rust

//! Native-messaging framing (src/framing.rs): never panics or over-allocates, and every frame read
//! back is one that write_frame would have produced.
#![no_main]
use kestrove_desktop::framing::{read_frame, write_frame, MAX_FRAME};
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
let mut r = data;
while let Ok(Some(frame)) = read_frame(&mut r) {
assert!(frame.len() <= MAX_FRAME);
let mut out = Vec::new();
write_frame(&mut out, &frame).expect("re-frame");
let mut again = out.as_slice();
assert_eq!(
read_frame(&mut again).unwrap().as_deref(),
Some(frame.as_slice())
);
}
});