Define a fuzz target for the parser
This commit is contained in:
committed by
Chris Fallin
parent
cfaa35d8c0
commit
825258939b
25
cranelift/isle/Cargo.lock
generated
25
cranelift/isle/Cargo.lock
generated
@@ -35,6 +35,12 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "577b08a4acd7b99869f863c50011b01eb73424ccc798ecd996f2e24817adfca7"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
@@ -148,6 +154,14 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "isle-fuzz"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"isle",
|
||||
"libfuzzer-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "islec"
|
||||
version = "0.1.0"
|
||||
@@ -171,6 +185,17 @@ version = "0.2.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36a9a84a6e8b55dfefb04235e55edb2b9a2a18488fcae777a6bdaa6f06f1deb3"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"cc",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
[workspace]
|
||||
members = [ "isle", "islec" ]
|
||||
members = [
|
||||
"./fuzz",
|
||||
"./isle",
|
||||
"./islec",
|
||||
]
|
||||
|
||||
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