Closed Bug 576828 Opened 14 years ago Closed 13 years ago

Regexp engines disagree on seemingly nonsensical recursive backreference

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: cdleary)

References

Details

(Keywords: testcase, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

/(z\1){3}/.exec("zzz");

OLD: ["zzz", "z"]
YARR: null
According to ES 3 and 5's definition of RepeatMatcher (step 4), ["zzz", "z"] (OLD) is correct, and YARR is wrong. If step 4 is skipped (which appears to be what happens for both YARR and IE), /(z\1){3}/ matches "zzzzzz" only (returning ["zzzzzz", "zzz"]).

(Note that, outside of ECMAScript-based regex implementations where backreferences to nonparticipating groups match the empty string, this regex can't match anything.)
Assignee: general → cdleary
Status: NEW → ASSIGNED
Severity: normal → minor
Hi, OOI this seems to be fixed in yarr in ToT WebKit.  Not sure when the fix went in I'm afraid, just thought I'd mention in case it hunting down the change would be an easier way to fix.

cheers,
G.
This was fixed by the YARR update (bug 625600). Nice simple test to add to our suite so we can close this out.
Attachment #537269 - Flags: review?(dmandelin)
Attachment #537269 - Flags: review?(dmandelin) → review+
Depends on: 625600
http://hg.mozilla.org/mozilla-central/rev/31a757125589
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: