Hi!
The tutorial section of the book uses this example:
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate url;
fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
let _ = url::Url::parse(s);
}
});
This example works, but is of course not as idiomatic as this:
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate url;
fuzz_target!(|data: &str| {
let _ = url::Url::parse(data);
});
I understand why you'd want to use the &[u8] to explain how the fuzzer works, but I think the second example should at least be mentioned in addition to the first. If you don't want to add it to the tutorial section, then maybe consider adding it to the Structure-Aware Fuzzing section, because I don't think &str is mentioned there either.
Hi!
The tutorial section of the book uses this example:
This example works, but is of course not as idiomatic as this:
I understand why you'd want to use the
&[u8]to explain how the fuzzer works, but I think the second example should at least be mentioned in addition to the first. If you don't want to add it to the tutorial section, then maybe consider adding it to the Structure-Aware Fuzzing section, because I don't think&stris mentioned there either.