mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
seq: fuzz PreciseNumber::from_str (#6183)
* fuzz the seq parse number functions * run fuzz_parse_number into the CI
This commit is contained in:
parent
b617876372
commit
10def29b96
4 changed files with 27 additions and 0 deletions
2
.github/workflows/fuzzing.yml
vendored
2
.github/workflows/fuzzing.yml
vendored
|
@ -58,6 +58,8 @@ jobs:
|
||||||
- { name: fuzz_parse_glob, should_pass: true }
|
- { name: fuzz_parse_glob, should_pass: true }
|
||||||
- { name: fuzz_parse_size, should_pass: true }
|
- { name: fuzz_parse_size, should_pass: true }
|
||||||
- { name: fuzz_parse_time, should_pass: true }
|
- { name: fuzz_parse_time, should_pass: true }
|
||||||
|
- { name: fuzz_seq_parse_number, should_pass: true }
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
|
|
|
@ -92,6 +92,12 @@ path = "fuzz_targets/fuzz_test.rs"
|
||||||
test = false
|
test = false
|
||||||
doc = false
|
doc = false
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "fuzz_seq_parse_number"
|
||||||
|
path = "fuzz_targets/fuzz_seq_parse_number.rs"
|
||||||
|
test = false
|
||||||
|
doc = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "fuzz_parse_glob"
|
name = "fuzz_parse_glob"
|
||||||
path = "fuzz_targets/fuzz_parse_glob.rs"
|
path = "fuzz_targets/fuzz_parse_glob.rs"
|
||||||
|
|
15
fuzz/fuzz_targets/fuzz_seq_parse_number.rs
Normal file
15
fuzz/fuzz_targets/fuzz_seq_parse_number.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// This file is part of the uutils coreutils package.
|
||||||
|
//
|
||||||
|
// For the full copyright and license information, please view the LICENSE
|
||||||
|
// file that was distributed with this source code.
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use libfuzzer_sys::fuzz_target;
|
||||||
|
use std::str::FromStr;
|
||||||
|
use uu_seq::number::PreciseNumber;
|
||||||
|
|
||||||
|
fuzz_target!(|data: &[u8]| {
|
||||||
|
if let Ok(s) = std::str::from_utf8(data) {
|
||||||
|
let _ = PreciseNumber::from_str(s);
|
||||||
|
}
|
||||||
|
});
|
|
@ -14,6 +14,10 @@ use uucore::{format_usage, help_about, help_usage};
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod extendedbigdecimal;
|
mod extendedbigdecimal;
|
||||||
|
// public to allow fuzzing
|
||||||
|
#[cfg(fuzzing)]
|
||||||
|
pub mod number;
|
||||||
|
#[cfg(not(fuzzing))]
|
||||||
mod number;
|
mod number;
|
||||||
mod numberparse;
|
mod numberparse;
|
||||||
use crate::error::SeqError;
|
use crate::error::SeqError;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue