test: cargo-fuzz targets on parser and framing
Four libFuzzer targets: - parse_command: Command::from_bytes never panics; bounded payload. - parse_radio_config: RadioConfig::from_bytes never panics. - cobs_decoder_feed: CobsDecoder::feed is panic-free across arbitrary byte streams split into arbitrary chunks. - cobs_roundtrip: structure-aware (via arbitrary crate) Response → cobs_encode_response → ucobs::decode yields identical raw bytes. All four smoke-tested at 50k runs each with no findings. Intended CI cadence is a weekly cron with a larger time budget; per-PR would be expensive. Requires nightly + cargo-fuzz.
This commit is contained in:
6 files changed
+241
No files matched your search
@@ -0,0 +1,14 @@
|
||||
//! `Command::from_bytes` must never panic on arbitrary input.
|
||||
//!
|
||||
//! Any accepted command must also respect the heapless payload bound.
|
||||
|
||||
#![no_main]
|
||||
|
||||
use donglora_protocol::{Command, MAX_PAYLOAD};
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Some(Command::Transmit { payload, .. }) = Command::from_bytes(data) {
|
||||
assert!(payload.len() <= MAX_PAYLOAD);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user