mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
add fuzzing for the date function
Work done Rafał Mikrut
This commit is contained in:
parent
510cafea8a
commit
a56e05cf63
3 changed files with 42 additions and 0 deletions
3
src/uu/date/fuzz/.gitignore
vendored
Normal file
3
src/uu/date/fuzz/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
target
|
||||||
|
corpus
|
||||||
|
artifacts
|
26
src/uu/date/fuzz/Cargo.toml
Normal file
26
src/uu/date/fuzz/Cargo.toml
Normal 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
|
13
src/uu/date/fuzz/fuzz_targets/fuzz_target_1.rs
Normal file
13
src/uu/date/fuzz/fuzz_targets/fuzz_target_1.rs
Normal 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);
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue