Bug 1470771: Follow-up: Fix null deref in Windows GPU process. r=me
authorKris Maglione <maglione.k@gmail.com>
Sat, 30 Jun 2018 16:37:51 -0700
changeset 424570 c8dd2790ee1d6f87dcb381ec44abdf8a594ed828
parent 424569 a6c3f14dccbcfa9021ca454470b4a48d79226246
child 424577 a47d3fbc3c569a7421d5f559201a7349c45ce603
push id104851
push usermaglione.k@gmail.com
push dateSat, 30 Jun 2018 23:38:57 +0000
treeherdermozilla-inbound@c8dd2790ee1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1470771
milestone63.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 1470771: Follow-up: Fix null deref in Windows GPU process. r=me
intl/strres/nsStringBundle.cpp
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -207,17 +207,20 @@ public:
     return mStringMap->CloneFileDescriptor();
   }
 
   size_t MapSize() const
   {
     if (mMapFile.isSome()) {
       return mMapSize;
     }
-    return mStringMap->MapSize();
+    if (mStringMap) {
+      return mStringMap->MapSize();
+    }
+    return 0;
   }
 
   bool Initialized() const { return mStringMap || mMapFile.isSome(); }
 
   StringBundleDescriptor GetDescriptor() const
   {
     MOZ_ASSERT(Initialized());
 
@@ -383,26 +386,23 @@ nsStringBundleBase::CollectReports(nsIHa
   // There's no need to anonymize.
   nsAutoCStringN<64> escapedURL(mPropertiesURL);
   escapedURL.ReplaceChar('/', '\\');
 
   size_t sharedSize = 0;
   size_t heapSize = SizeOfIncludingThis(MallocSizeOf);
 
   nsAutoCStringN<256> path("explicit/string-bundles/");
-  {
-    RefPtr<SharedStringBundle> shared = do_QueryObject(this);
-    if (shared) {
-      path.AppendLiteral("SharedStringBundle");
-      if (XRE_IsParentProcess()) {
-        sharedSize = shared->MapSize();
-      }
-    } else {
-      path.AppendLiteral("nsStringBundle");
+  if (RefPtr<SharedStringBundle> shared = do_QueryObject(this)) {
+    path.AppendLiteral("SharedStringBundle");
+    if (XRE_IsParentProcess()) {
+      sharedSize = shared->MapSize();
     }
+  } else {
+    path.AppendLiteral("nsStringBundle");
   }
 
   path.AppendLiteral("(url=\"");
   path.Append(escapedURL);
 
   // Note: The memory reporter service holds a strong reference to reporters
   // while collecting reports, so we want to ignore the extra ref in reports.
   path.AppendLiteral("\", shared=");