Haibo Huang | 1d704cd | 2020-11-02 18:46:32 -0800 | [diff] [blame] | 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 | } |
| 13 | |
| 14 | // See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26505 |
| 15 | // See: https://github.com/rust-lang/regex/issues/722 |
| 16 | #[test] |
| 17 | fn empty_any_errors_no_panic() { |
| 18 | assert!(regex_new!(r"\P{any}").is_err()); |
| 19 | } |
Joel Galenson | 3874808 | 2021-05-19 16:51:51 -0700 | [diff] [blame^] | 20 | |
| 21 | // This tests that a very large regex errors during compilation instead of |
| 22 | // using gratuitous amounts of memory. The specific problem is that the |
| 23 | // compiler wasn't accounting for the memory used by Unicode character classes |
| 24 | // correctly. |
| 25 | // |
| 26 | // See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33579 |
| 27 | #[test] |
| 28 | fn big_regex_fails_to_compile() { |
| 29 | let pat = "[\u{0}\u{e}\u{2}\\w~~>[l\t\u{0}]p?<]{971158}"; |
| 30 | assert!(regex_new!(pat).is_err()); |
| 31 | } |