Add fuzzing (#15)
This commit is contained in:
parent
3cade858fa
commit
42c84079c3
3 changed files with 29 additions and 0 deletions
|
@ -8,6 +8,7 @@ members = [
|
|||
"bench",
|
||||
"bench/tools/gen_large_yaml",
|
||||
"bench/tools/bench_compare",
|
||||
"fuzz",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
|
|
19
fuzz/Cargo.toml
Normal file
19
fuzz/Cargo.toml
Normal file
|
@ -0,0 +1,19 @@
|
|||
[package]
|
||||
name = "saphyr-fuzz"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
libfuzzer-sys = "0.4"
|
||||
saphyr.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "parse"
|
||||
path = "fuzz_targets/parse.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
9
fuzz/fuzz_targets/parse.rs
Normal file
9
fuzz/fuzz_targets/parse.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(s) = std::str::from_utf8(data) {
|
||||
let _ = saphyr::Yaml::load_from_str(s);
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue