1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

add fuzzing for the date function

Work done Rafał Mikrut
This commit is contained in:
Sylvestre Ledru 2023-02-18 21:44:24 +01:00
parent 510cafea8a
commit a56e05cf63
3 changed files with 42 additions and 0 deletions

3
src/uu/date/fuzz/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
target
corpus
artifacts

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

View file

@ -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);
});