Closed
Bug 696723
Opened 13 years ago
Closed 3 years ago
Exponential regular expressions no longer throw an exception
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 1391654
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.
Comment 1•13 years ago
|
||
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.
Reporter | ||
Comment 2•13 years ago
|
||
(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...
Comment 3•12 years ago
|
||
Safari also hangs on this regular expression.
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 5•3 years ago
|
||
Hey Wladimir,
Does this issue still occur for you or can it be closed?
Flags: needinfo?(ecfbugzilla)
Reporter | ||
Comment 6•3 years ago
|
||
Yes, this is still problematic. The delay isn’t noticeable with the short string I posted in comment 0 but a test string twice as long hangs up the content process for around 20 seconds:
/a*a*a*a*a*a*a*b/.test("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
Flags: needinfo?(ecfbugzilla)
Comment 7•3 years ago
|
||
Bug 1391654 tracks potential solutions for exponential blowup of regexp execution.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•