Closed
Bug 877912
Opened 12 years ago
Closed 12 years ago
Very easy to hang with sticky global regexp
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
mozilla24
People
(Reporter: jruderman, Assigned: sstangl)
References
Details
(Keywords: hang, testcase)
Attachments
(2 files)
1.03 KB,
patch
|
mjrosenb
:
review+
|
Details | Diff | Splinter Review |
568 bytes,
patch
|
mjrosenb
:
review+
lsblakk
:
approval-mozilla-aurora+
lsblakk
:
approval-mozilla-beta-
|
Details | Diff | Splinter Review |
This hangs the shell:
var r = /(\1)/gy;
var s = "Z";
s.match(r);
So does this:
var r = /((?=a))+/gy;
var s = "aa";
s.match(r);
Assignee | ||
Comment 1•12 years ago
|
||
Most likely a regression from Bug 876976.
Assignee: general → sstangl
Depends on: 876976
Assignee | ||
Comment 2•12 years ago
|
||
This is a longstanding bug from the MatchOnly refactoring. IIRC this affects release -- it won't loop forever, but results for sticky regexps in MatchOnly scenarios will be nonsense. But only when compilation fails and we fall back to the YARR interpreter.
The problem is that the "result" value, representing the start offset, did not have the sticky displacement applied. This caused empty matches to appear to have a positive length.
This patch also fixed calling displace() for all of the matches, when only displacing the first match is necessary.
Attachment #756277 -
Flags: review?(kvijayan)
Assignee | ||
Updated•12 years ago
|
status-firefox21:
--- → affected
status-firefox22:
--- → affected
status-firefox23:
--- → affected
status-firefox24:
--- → affected
Comment 3•12 years ago
|
||
Comment on attachment 756277 [details] [diff] [review]
Correctly apply displament to MatchOnly results in sticky mode
Review of attachment 756277 [details] [diff] [review]:
-----------------------------------------------------------------
I don't know this code that well, but based on the description of the bug, this looks like a reasonable course of action.
Attachment #756277 -
Flags: review?(kvijayan) → review+
Assignee | ||
Comment 4•12 years ago
|
||
Thanks! I'll put up a minimalistic patch to fix aurora (maybe beta) once this gets onto m-c.
https://hg.mozilla.org/integration/mozilla-inbound/rev/1d1e0a7011fd
Assignee | ||
Comment 5•12 years ago
|
||
Same fix, without removing the unnecessary O(n) patching.
Attachment #758272 -
Flags: review?(mrosenberg)
Updated•12 years ago
|
Attachment #758272 -
Flags: review?(mrosenberg) → review+
Comment 6•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Assignee | ||
Comment 7•12 years ago
|
||
Comment on attachment 758272 [details] [diff] [review]
Minimal patch for beta and aurora
[Approval Request Comment]
Bug caused by (feature/regressing bug #): 808245
User impact if declined: Executing certain regexps causes the browser to enter indefinite busy loops.
Testing completed (on m-c, etc.): m-c, local
Risk to taking this patch (and alternatives if risky): none
String or IDL/UUID changes made by this patch: none
Attachment #758272 -
Flags: approval-mozilla-beta?
Attachment #758272 -
Flags: approval-mozilla-aurora?
Reporter | ||
Comment 8•12 years ago
|
||
It might be good to add some correctness tests for these kinds of regexps.
Flags: in-testsuite?
Updated•12 years ago
|
Comment 9•12 years ago
|
||
Comment on attachment 758272 [details] [diff] [review]
Minimal patch for beta and aurora
this has been around since FF20 so let's take it on Aurora and let it ride the trains to beta to avoid unnecessary risk in the last betas.
Attachment #758272 -
Flags: approval-mozilla-beta?
Attachment #758272 -
Flags: approval-mozilla-beta-
Attachment #758272 -
Flags: approval-mozilla-aurora?
Attachment #758272 -
Flags: approval-mozilla-aurora+
Comment 10•12 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/70f5ae9b46ff
I forgot to set the author before pushing :(. Please make sure your attached patches have it in the future.
Comment 11•11 years ago
|
||
Reproduced in nightly 2013-05-30 using the testcases in comment 0.
No hang in jshell-mac FF 24b6, Mac OS X 10.7.5.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•