blob: ef5bf2a8a44c097bc1e2c7e4618befa9443fa27e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#![no_main]
use libfuzzer_sys::fuzz_target;
use tor_netdoc::doc::routerdesc::RouterReader;
use tor_netdoc::AllowAnnotations;
fuzz_target!(|data: &[u8]| {
if data.len() > 0 {
let allow = if (data[0] & 1) == 0 {
AllowAnnotations::AnnotationsAllowed
} else {
AllowAnnotations::AnnotationsNotAllowed
};
if let Ok(s) = std::str::from_utf8(&data[1..]) {
let _ = RouterReader::new(s, allow).count();
}
}
});
|