Define a fuzz target for the parser

This commit is contained in:
Nick Fitzgerald
2021-09-28 15:54:01 -07:00
committed by Chris Fallin
parent cfaa35d8c0
commit 825258939b
5 changed files with 61 additions and 1 deletions

3
cranelift/isle/fuzz/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
target
corpus
artifacts

View 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

View 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();
});