From 1878228db7e57e478a12753bb36acc9a75638bbf Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 12 Nov 2024 14:30:36 +0100 Subject: [PATCH] Issue #2305 Part 4: Check for failure when getting RegExp match result template Null deref crash fix. --- js/src/builtin/RegExp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 235d6e8bfc..61382e6aac 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -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;