Add fuzz target for cranelift_reader::parse_test.
This commit is contained in:
committed by
Dan Gohman
parent
eed861c6e1
commit
299898d494
@@ -12,6 +12,7 @@ cargo-fuzz = "*"
|
|||||||
binaryen = { git = "https://github.com/pepyakin/binaryen-rs.git" }
|
binaryen = { git = "https://github.com/pepyakin/binaryen-rs.git" }
|
||||||
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
|
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
|
||||||
cranelift-wasm = { path = "../lib/wasm" }
|
cranelift-wasm = { path = "../lib/wasm" }
|
||||||
|
cranelift-reader = { path = "../lib/reader" }
|
||||||
target-lexicon = "0.0.3"
|
target-lexicon = "0.0.3"
|
||||||
|
|
||||||
# Prevent this from interfering with workspaces
|
# Prevent this from interfering with workspaces
|
||||||
@@ -21,3 +22,7 @@ members = ["."]
|
|||||||
[[bin]]
|
[[bin]]
|
||||||
name = "fuzz_translate_module"
|
name = "fuzz_translate_module"
|
||||||
path = "fuzz_translate_module.rs"
|
path = "fuzz_translate_module.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "fuzz_reader_parse_test"
|
||||||
|
path = "fuzz_reader_parse_test.rs"
|
||||||
|
|||||||
11
cranelift/fuzz/fuzz_reader_parse_test.rs
Normal file
11
cranelift/fuzz/fuzz_reader_parse_test.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#![no_main]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate libfuzzer_sys;
|
||||||
|
extern crate cranelift_reader;
|
||||||
|
use std::str;
|
||||||
|
|
||||||
|
fuzz_target!(|data: &[u8]| {
|
||||||
|
if let Ok(s) = str::from_utf8(data) {
|
||||||
|
let _ = cranelift_reader::parse_test(s);
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user