aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/fuzz
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/fuzz')
-rw-r--r--crates/ra_syntax/fuzz/.gitignore4
-rw-r--r--crates/ra_syntax/fuzz/Cargo.toml22
-rw-r--r--crates/ra_syntax/fuzz/fuzz_targets/parser.rs9
3 files changed, 35 insertions, 0 deletions
diff --git a/crates/ra_syntax/fuzz/.gitignore b/crates/ra_syntax/fuzz/.gitignore
new file mode 100644
index 000000000..572e03bdf
--- /dev/null
+++ b/crates/ra_syntax/fuzz/.gitignore
@@ -0,0 +1,4 @@
1
2target
3corpus
4artifacts
diff --git a/crates/ra_syntax/fuzz/Cargo.toml b/crates/ra_syntax/fuzz/Cargo.toml
new file mode 100644
index 000000000..65ded6a21
--- /dev/null
+++ b/crates/ra_syntax/fuzz/Cargo.toml
@@ -0,0 +1,22 @@
1
2[package]
3name = "ra_syntax-fuzz"
4version = "0.0.1"
5authors = ["Automatically generated"]
6publish = false
7
8[package.metadata]
9cargo-fuzz = true
10
11[dependencies.ra_syntax]
12path = ".."
13[dependencies.libfuzzer-sys]
14git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
15
16# Prevent this from interfering with workspaces
17[workspace]
18members = ["."]
19
20[[bin]]
21name = "parser"
22path = "fuzz_targets/parser.rs"
diff --git a/crates/ra_syntax/fuzz/fuzz_targets/parser.rs b/crates/ra_syntax/fuzz/fuzz_targets/parser.rs
new file mode 100644
index 000000000..396c0ecaf
--- /dev/null
+++ b/crates/ra_syntax/fuzz/fuzz_targets/parser.rs
@@ -0,0 +1,9 @@
1#![no_main]
2#[macro_use] extern crate libfuzzer_sys;
3extern crate ra_syntax;
4
5fuzz_target!(|data: &[u8]| {
6 if let Ok(text) = std::str::from_utf8(data) {
7 ra_syntax::utils::check_fuzz_invariants(text)
8 }
9});