mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
move the fuzz_date fuzzers
This commit is contained in:
parent
234ef07abd
commit
e553a4a21c
3 changed files with 7 additions and 4 deletions
3
fuzz/.gitignore
vendored
Normal file
3
fuzz/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
target
|
||||
corpus
|
||||
artifacts
|
29
fuzz/Cargo.toml
Normal file
29
fuzz/Cargo.toml
Normal 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
fuzz/fuzz_targets/fuzz_date.rs
Normal file
16
fuzz/fuzz_targets/fuzz_date.rs
Normal 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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue