Bug 1074591 (part 3) - Fix unbounded growth in JSONWriter's vectors(!). r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 02 Oct 2014 18:01:41 -0700
changeset 231721 31b722e8e85d107b3c741d43301c1954fe2b8df1
parent 231720 1eb845ba1fc6328cd7c56b73d9948d6e227de271
child 231722 1b49657fad19bdf715df159e26ad1950b75eaa23
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1074591
milestone35.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 1074591 (part 3) - Fix unbounded growth in JSONWriter's vectors(!). r=froydnj.
mfbt/JSONWriter.h
--- a/mfbt/JSONWriter.h
+++ b/mfbt/JSONWriter.h
@@ -296,18 +296,18 @@ private:
     mWriter->Write("\"");
     mNeedComma[mDepth] = true;
   }
 
   void NewVectorEntries()
   {
     // If these tiny allocations OOM we might as well just crash because we
     // must be in serious memory trouble.
-    MOZ_RELEASE_ASSERT(mNeedComma.growByUninitialized(1));
-    MOZ_RELEASE_ASSERT(mNeedNewlines.growByUninitialized(1));
+    MOZ_RELEASE_ASSERT(mNeedComma.resizeUninitialized(mDepth + 1));
+    MOZ_RELEASE_ASSERT(mNeedNewlines.resizeUninitialized(mDepth + 1));
     mNeedComma[mDepth] = false;
     mNeedNewlines[mDepth] = true;
   }
 
   void StartCollection(const char* aMaybePropertyName, const char* aStartChar,
                        CollectionStyle aStyle = MultiLineStyle)
   {
     Separator();