Define a fuzz target for the parser
This commit is contained in:
committed by
Chris Fallin
parent
cfaa35d8c0
commit
825258939b
3
cranelift/isle/fuzz/.gitignore
vendored
Normal file
3
cranelift/isle/fuzz/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
target
|
||||
corpus
|
||||
artifacts
|
||||
19
cranelift/isle/fuzz/Cargo.toml
Normal file
19
cranelift/isle/fuzz/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "isle-fuzz"
|
||||
version = "0.0.0"
|
||||
authors = ["Automatically generated"]
|
||||
publish = false
|
||||
edition = "2018"
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
isle = { path = "../isle" }
|
||||
libfuzzer-sys = "0.4"
|
||||
|
||||
[[bin]]
|
||||
name = "parse"
|
||||
path = "fuzz_targets/parse.rs"
|
||||
test = false
|
||||
doc = false
|
||||
9
cranelift/isle/fuzz/fuzz_targets/parse.rs
Normal file
9
cranelift/isle/fuzz/fuzz_targets/parse.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|s: &str| {
|
||||
let lexer = isle::lexer::Lexer::from_str(s, "fuzz-input.isle");
|
||||
let mut parser = isle::parser::Parser::new(lexer);
|
||||
let _ = parser.parse_defs();
|
||||
});
|
||||
Reference in New Issue
Block a user