Closed Bug 1640487 Opened 4 years ago Closed 4 years ago

Crash with RegExp named capture groups, likely missing typeset information

Categories

(Core :: JavaScript Engine: JIT, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox-esr68 --- unaffected
firefox76 --- unaffected
firefox77 --- unaffected
firefox78 --- fixed

People

(Reporter: anba, Assigned: iain)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

The following test case crashes when run with --ion-offthread-compile=off:

var re = /(?<x>a)|b/;

function f(j) {
    for (var i = 0; i <= 10_000; ++i) {
        var s = String.fromCharCode(0x61 + (i === 10_000 && j === 2));
        var e = re.exec(s);
        if (e.groups.x !== "a") print(i,j);
    }
}

for (var i = 0; i <= 2; ++i) print(f(i));

I suspect bad type-set information comes into play here.

Adding AddTypePropertyId(cx, templateObject, id, UndefinedValue()); after NativeDefineDataProperty in RegExpShared::initializeNamedCaptures could be a likely fix.

Good catch!

Assignee: nobody → iireland
Status: NEW → ASSIGNED
Group: core-security → javascript-core-security

This bug was introduced when we added named captures in bug 1362154 and is only present in Nightly.

Severity: -- → S3
Priority: -- → P1
Regressed by: 1362154
Has Regression Range: --- → yes
Keywords: regression
Group: javascript-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: