From c51486d9f102bdf4ecb657a437c164fd7f425096 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Thu, 6 Jul 2023 08:45:25 -0400 Subject: [PATCH] fuzz: tweak limits This new fuzzer program caught a timeout. It looks mostly uninteresting. It's basically the result of a huge regex running on a decently sized haystack that is forced to use the PikeVM. The PikeVM is slow. We know that. Ref https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60402 --- fuzz/fuzz_targets/fuzz_regex_match.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/fuzz_regex_match.rs b/fuzz/fuzz_targets/fuzz_regex_match.rs index ae4d8a2d4..6c375510d 100644 --- a/fuzz/fuzz_targets/fuzz_regex_match.rs +++ b/fuzz/fuzz_targets/fuzz_regex_match.rs @@ -54,6 +54,9 @@ re.is_match({haystack:?}); fuzz_target!(|case: FuzzCase| -> Corpus { let _ = env_logger::try_init(); + if case.haystack.len() > (16 * (1 << 10)) { + return Corpus::Reject; + } let Ok(re) = regex::RegexBuilder::new(case.pattern) .case_insensitive(case.case_insensitive) .multi_line(case.multi_line) @@ -62,7 +65,7 @@ fuzz_target!(|case: FuzzCase| -> Corpus { .ignore_whitespace(case.ignore_whitespace) .unicode(case.unicode) .octal(case.octal) - .size_limit(1<<20) + .size_limit(1<<18) .build() else { return Corpus::Reject }; re.is_match(case.haystack); Corpus::Keep