Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions crates/bashkit/fuzz/fuzz_targets/arithmetic_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ fuzz_target!(|data: &[u8]| {
return;
}

// Reject inputs that themselves contain banned substrings — this
// target inlines `input` into `echo $((input))`. With unbalanced
// parens the arithmetic expansion can close early and the
// remainder is parsed as commands; bash then echoes the unknown
// command verbatim ("bash: /.rustup/toolchains/gww: No such file
// or directory"). That is real-shell stderr, not a TM-INF-022
// leak. Filtering at the fuzz-input layer keeps the harness's
// leak detector strict for real internals while avoiding false
// positives. (Mirrors glob_fuzz.)
for pat in bashkit::testing::UNIVERSAL_BANNED {
if input.contains(pat) {
return;
}
}

// Wrap input in arithmetic expansion context
let script = format!("echo $(({}))", input);

Expand Down
Loading