mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-22 11:13:44 +00:00
ee1c0fd143
Currently `PlainHeader::decode` and `PartialDecoder::new` expect a `local_cid_len`, which means they cannot support variable length Connection ID format and make it less useful in various use cases, such as implementing a [QUIC-LB] confirming load balancer. [QUIC-LB]: https://www.ietf.org/archive/id/draft-ietf-quic-load-balancers-19.html
26 lines
684 B
Rust
26 lines
684 B
Rust
#![no_main]
|
|
|
|
extern crate proto;
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
use proto::{
|
|
fuzzing::{PacketParams, PartialDecode},
|
|
FixedLengthConnectionIdParser, DEFAULT_SUPPORTED_VERSIONS,
|
|
};
|
|
|
|
fuzz_target!(|data: PacketParams| {
|
|
let len = data.buf.len();
|
|
let supported_versions = DEFAULT_SUPPORTED_VERSIONS.to_vec();
|
|
if let Ok(decoded) = PartialDecode::new(
|
|
data.buf,
|
|
&FixedLengthConnectionIdParser::new(data.local_cid_len),
|
|
&supported_versions,
|
|
data.grease_quic_bit,
|
|
) {
|
|
match decoded.1 {
|
|
Some(x) => assert_eq!(len, decoded.0.len() + x.len()),
|
|
None => assert_eq!(len, decoded.0.len()),
|
|
}
|
|
}
|
|
});
|