Issue #2305 Part 4: Check for failure when getting RegExp match result template

Null deref crash fix.
This commit is contained in:
Moonchild 2024-11-12 14:30:36 +01:00 committed by roytam1
commit 1878228db7

View file

@ -99,6 +99,9 @@ js::CreateRegExpMatchResult(JSContext* cx, RegExpShared& re,
// MakeIndicesArray: step 8
ArrayObject* indicesTemplate =
cx->compartment()->regExps.getOrCreateMatchResultTemplateObject(cx, RegExpCompartment::ResultTemplateKind::Indices);
if (!indicesTemplate) {
return false;
}
indices = NewDenseFullyAllocatedArrayWithTemplate(cx, numPairs, indicesTemplate);
if (!indices) {
return false;