Skip to content

Commit

Permalink
fuzz: compile fuzzer in release mode
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BurntSushi committed Oct 13, 2020
1 parent d5bf98f commit 9067dfd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ members = ["."]
[[bin]]
name = "fuzz_regex_match"
path = "fuzz_targets/fuzz_regex_match.rs"

[profile.release]
opt-level = 3
debug = true
12 changes: 12 additions & 0 deletions tests/regression_fuzz.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// These tests are only run for the "default" test target because some of them
// can take quite a long time. Some of them take long enough that it's not
// practical to run them in debug mode. :-/

// See: https://oss-fuzz.com/testcase-detail/5673225499181056
//
// Ignored by default since it takes too long in debug mode (almost a minute).
#[test]
#[ignore]
fn fuzz1() {
regex!(r"1}{55}{0}*{1}{55}{55}{5}*{1}{55}+{56}|;**");
}
1 change: 1 addition & 0 deletions tests/test_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ mod misc;
mod multiline;
mod noparse;
mod regression;
mod regression_fuzz;
mod replace;
mod searcher;
mod set;
Expand Down

0 comments on commit 9067dfd

Please sign in to comment.