Bug 1262936 - Add missing OOM check to RegExpStack::reset. r=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 13 Apr 2016 09:31:06 +0200
changeset 330863 9943bdffe5045968571f18ba6a283cbb5df894e0
parent 330862 bd7b47bc93278bc309decec2f0b2d4e44c675f24
child 330864 ce4af341b03e8737f4cd1eec50697ae4d5e87c49
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs1262936
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1262936 - Add missing OOM check to RegExpStack::reset. r=bhackett
js/src/irregexp/RegExpStack.cpp
--- a/js/src/irregexp/RegExpStack.cpp
+++ b/js/src/irregexp/RegExpStack.cpp
@@ -72,17 +72,21 @@ RegExpStack::init()
 }
 
 void
 RegExpStack::reset()
 {
     MOZ_ASSERT(size >= kMinimumStackSize);
 
     if (size != kMinimumStackSize) {
-        base_ = js_realloc(base_, kMinimumStackSize);
+        void* newBase = js_realloc(base_, kMinimumStackSize);
+        if (!newBase)
+            return;
+
+        base_ = newBase;
         size = kMinimumStackSize;
         updateLimit();
     }
 }
 
 bool
 RegExpStack::grow()
 {