Skip to content

Commit

Permalink
fuzz: don't run on big haystacks
Browse files Browse the repository at this point in the history
We keep beating back the OSS-fuzz timeouts. It keeps finding bigger and
bigger haystacks with even smallish regexes that have Unicode word
boundaries in them. This results in using the PikeVM which is just slow.
There's really nothing to be done other than to tell the fuzzer: "this
is OK."
  • Loading branch information
BurntSushi committed May 24, 2023
1 parent 8afffab commit d555d61
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fuzz/fuzz_targets/fuzz_regex_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ fuzz_target!(|data: &[u8]| {
let char_index = data.char_indices().nth(split_off_point);
if let Some((char_index, _)) = char_index {
let (pattern, input) = data.split_at(char_index);
// If the haystack is big, don't use it. The issue is that
// the fuzzer is compiled with sanitizer options and it makes
// everything pretty slow. This was put in here as a result of
// getting timeout errors from OSS-fuzz. There's really nothing to
// be done about them. Unicode word boundaries in the PikeVM are
// slow. It is what it is.
if input.len() >= 8 * (1 << 10) {
return;
}
let result =
regex::RegexBuilder::new(pattern).size_limit(1 << 18).build();
if let Ok(re) = result {
Expand Down

0 comments on commit d555d61

Please sign in to comment.