Adding fuzzers for unsafe code.

This commit is contained in:
Adrian Taylor
2022-02-02 14:59:53 -08:00
parent fcc508e1c7
commit aa989b0fba
3 changed files with 50 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
[package]
name = "shlex-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.shlex]
path = ".."
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "fuzz_next"
path = "fuzz_targets/fuzz_next.rs"
test = false
doc = false
[[bin]]
name = "fuzz_quote"
path = "fuzz_targets/fuzz_quote.rs"
test = false
doc = false
+10
View File
@@ -0,0 +1,10 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
use shlex::Shlex;
fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
let mut sh = Shlex::new(s);
while let Some(word) = sh.next() {}
}
});
+9
View File
@@ -0,0 +1,9 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
use shlex::quote;
fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
quote(s);
}
});