Skip to content

Commit 9067dfd

Browse files
committed
fuzz: compile fuzzer in release mode
Otherwise, it's pretty easy to generate regexes that are under the size limit but take longer than the 60 second timeout in the fuzzer. This is in response to this bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26324 Actual fuzz test output: https://oss-fuzz.com/testcase-detail/5673225499181056
1 parent d5bf98f commit 9067dfd

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

fuzz/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ members = ["."]
2121
[[bin]]
2222
name = "fuzz_regex_match"
2323
path = "fuzz_targets/fuzz_regex_match.rs"
24+
25+
[profile.release]
26+
opt-level = 3
27+
debug = true

tests/regression_fuzz.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// These tests are only run for the "default" test target because some of them
2+
// can take quite a long time. Some of them take long enough that it's not
3+
// practical to run them in debug mode. :-/
4+
5+
// See: https://oss-fuzz.com/testcase-detail/5673225499181056
6+
//
7+
// Ignored by default since it takes too long in debug mode (almost a minute).
8+
#[test]
9+
#[ignore]
10+
fn fuzz1() {
11+
regex!(r"1}{55}{0}*{1}{55}{55}{5}*{1}{55}+{56}|;**");
12+
}

tests/test_default.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ mod misc;
4949
mod multiline;
5050
mod noparse;
5151
mod regression;
52+
mod regression_fuzz;
5253
mod replace;
5354
mod searcher;
5455
mod set;

0 commit comments

Comments
 (0)