add fuzzing for the date function

Work done Rafał Mikrut
This commit is contained in:
Sylvestre Ledru
2023-03-10 00:03:26 +01:00
parent 510cafea8a
commit a56e05cf63
3 changed files with 42 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
target
corpus
artifacts
+26
View File
@@ -0,0 +1,26 @@
# spell-checker:ignore libfuzzer
[package]
name = "uu_date-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.uu_date]
path = ".."
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "fuzz_target_1"
path = "fuzz_targets/fuzz_target_1.rs"
test = false
doc = false
@@ -0,0 +1,13 @@
// spell-checker:ignore libfuzzer
#![no_main]
use libfuzzer_sys::fuzz_target;
use std::ffi::OsString;
use uu_date::uumain;
fuzz_target!(|data: &[u8]| {
let iter: Vec<OsString> = [""].into_iter().map(|e| OsString::from(e)).collect();
let it2 = iter.into_iter();
uumain(it2);
});