3 Commits

Author SHA1 Message Date
Andrew Gallant
41f14c2d9b fuzz: account for Unicode class size in compiler
This improves the precision of the "expression too big" regex
compilation error. Previously, it was not considering the heap usage
from Unicode character classes.

It's possible this will make some regexes fail to compile that
previously compiled. However, this is a bug fix. If you do wind up
seeing this though, feel free to file an issue, since it would be good
to get an idea of what kinds of regexes no longer compile but did.

This was found by OSS-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33579
2021-04-22 17:59:22 -04:00
Andrew Gallant
6fdb6e123c
syntax: forbid \P{any}
Previously, the translator would forbid constructs like [^\w\W] that
compiled to empty character classes. These things are forbidden not
because the translator can't handle it, but because the compile in
'regex' proper can't handle it. Once we migrate to the compiler in
regex-automata, which supports empty classes, then we can lift this
restriction. But until then, we should ban all such instances. It turns
out that \P{any} was another way to utter this, so we ban it in this
commit.

This was found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26505

Fixes #722
2020-11-01 11:25:11 -05:00
Andrew Gallant
9067dfd7e1
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
2020-10-13 19:15:52 -04:00