27 lines
908 B
Rust
27 lines
908 B
Rust
#![no_main]
|
|
|
|
use std::collections::HashMap;
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
use wgcloak::transport::http3::{
|
|
decode_auth_challenge, decode_capsule, decode_http_datagram, is_auth_accept,
|
|
verify_auth_response, AuthChallenge,
|
|
};
|
|
|
|
const MAX_INPUT: usize = 64 * 1024;
|
|
const MAX_DATAGRAM: usize = 16 * 1024;
|
|
|
|
fuzz_target!(|input: &[u8]| {
|
|
let input = &input[..input.len().min(MAX_INPUT)];
|
|
// All of these are in-memory parsers. decode_http_datagram bounds the
|
|
// copied payload, while the capsule/auth parsers only copy this bounded
|
|
// input or fixed-size fields.
|
|
let _ = decode_http_datagram(input, 0, MAX_DATAGRAM);
|
|
let _ = decode_capsule(input);
|
|
let _ = decode_auth_challenge(input);
|
|
let _ = is_auth_accept(input);
|
|
let challenge = AuthChallenge { bytes: [0; 32] };
|
|
let clients = HashMap::new();
|
|
let _ = verify_auth_response(&challenge, input, &clients);
|
|
});
|