mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:25:58 +02:00
Add 2 fuzzers for nu-path, nu-parser (#10376)
# Description This PR adds a fuzzer for the nu-path and the nu-parser crate. Now you can go to `crates/nu-path/fuzz`/`crates/nu-parser/fuzz` and run `cargo fuzz` to find crashes. https://github.com/nushell/nushell/issues/10365 and #9417 was found by this --------- Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
19d732f313
commit
bc7736bc99
13
crates/nu-parser/fuzz/fuzz_targets/parse.rs
Normal file
13
crates/nu-parser/fuzz/fuzz_targets/parse.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
use nu_parser::*;
|
||||
use nu_protocol::engine::{EngineState, StateWorkingSet};
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let engine_state = EngineState::new();
|
||||
let mut working_set = StateWorkingSet::new(&engine_state);
|
||||
|
||||
let _block = parse(&mut working_set, None, &data, true);
|
||||
});
|
Reference in New Issue
Block a user