move the fuzz_date fuzzers

This commit is contained in:
Sylvestre Ledru
2023-03-10 00:03:26 +01:00
parent 234ef07abd
commit e553a4a21c
3 changed files with 7 additions and 4 deletions
+3
View File
@@ -0,0 +1,3 @@
target
corpus
artifacts
+29
View File
@@ -0,0 +1,29 @@
# spell-checker:ignore libfuzzer
[package]
name = "uucore-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.uucore]
path = "../src/uucore/"
[dependencies.uu_date]
path = "../src/uu/date/"
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "fuzz_date"
path = "fuzz_targets/fuzz_date.rs"
test = false
doc = false
+16
View File
@@ -0,0 +1,16 @@
// spell-checker:ignore libfuzzer
#![no_main]
use libfuzzer_sys::fuzz_target;
use std::ffi::OsString;
use uu_date::uumain;
fuzz_target!(|data: &[u8]| {
let delim: u8 = 0; // Null byte
let args = data
.split(|b| *b == delim)
.filter_map(|e| std::str::from_utf8(e).ok())
.map(|e| OsString::from(e));
uumain(args);
});