Skip to content

Commit d555d61

Browse files
committed
fuzz: don't run on big haystacks
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."
1 parent 8afffab commit d555d61

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fuzz/fuzz_targets/fuzz_regex_match.rs

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ fuzz_target!(|data: &[u8]| {
1414
let char_index = data.char_indices().nth(split_off_point);
1515
if let Some((char_index, _)) = char_index {
1616
let (pattern, input) = data.split_at(char_index);
17+
// If the haystack is big, don't use it. The issue is that
18+
// the fuzzer is compiled with sanitizer options and it makes
19+
// everything pretty slow. This was put in here as a result of
20+
// getting timeout errors from OSS-fuzz. There's really nothing to
21+
// be done about them. Unicode word boundaries in the PikeVM are
22+
// slow. It is what it is.
23+
if input.len() >= 8 * (1 << 10) {
24+
return;
25+
}
1726
let result =
1827
regex::RegexBuilder::new(pattern).size_limit(1 << 18).build();
1928
if let Ok(re) = result {

0 commit comments

Comments
 (0)