Open Bug 696723 Opened 8 years ago Updated 5 years ago

Exponential regular expressions no longer throw an exception

Categories

(Core :: JavaScript Engine, defect, critical)

defect
Not set
critical

Tracking

()

People

(Reporter: ecfbugzilla, Unassigned)

References

Details

(Keywords: hang, regression)

It seems that the regexp engine no longer recognizes exponential regular expressions. Bug 330569 introduced javascript.options.relimit preference but searching the current source code I only see code that translates that preference into a JS environment option, nothing that would actually use that option afterwards. I suspect that it is unused ever since SpiderMonkey switched to the YARR engine.

Consider the following code:

/a*a*a*a*a*a*a*b/.test("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

In Firefox 3.6 it throws "regular expression too complex" exception. In Firefox 7.0.1 and 10.0a1 (both on Windows 7 x64) it simply hangs for a while and will hang much longer as the tested string gets longer.
Slow regexp searches should time out just as ordinary JS code times out.

The old "regular expression too complex" exception was a neat trick, but that's not how we want it to work.

The relimit pref is obsolete and should be removed.
(In reply to Jason Orendorff [:jorendorff] from comment #1)
> Slow regexp searches should time out just as ordinary JS code times out.

Would be nice but doesn't seem to happen here...
Safari also hangs on this regular expression.
Assignee: general → nobody
Duplicate of this bug: 1152680
You need to log in before you can comment on or make changes to this bug.