Bug 749648 - Null-check the return value of MapViewOfFile properly in CheckASLR; r=ehsan a=akeybl
authorKyle Huey <khuey@kylehuey.com>
Sat, 28 Apr 2012 17:11:40 -0400
changeset 95577 ea8c07d977c30190014e8101594acf68ead72929
parent 95576 3e32c74580f6014636a6af144f3f737d55425dd0
child 95578 6f99e37fc4c1fb3864c11ca26c0c99343544ffbe
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, akeybl
bugs749648
milestone14.0a2
Bug 749648 - Null-check the return value of MapViewOfFile properly in CheckASLR; r=ehsan a=akeybl
toolkit/xre/nsWindowsDllBlocklist.cpp
--- a/toolkit/xre/nsWindowsDllBlocklist.cpp
+++ b/toolkit/xre/nsWindowsDllBlocklist.cpp
@@ -171,17 +171,18 @@ struct RVAMap {
     DWORD alignedOffset = (offset / info.dwAllocationGranularity) *
                           info.dwAllocationGranularity;
 
     NS_ASSERTION(offset - alignedOffset < info.dwAllocationGranularity, "Wtf");
 
     mRealView = ::MapViewOfFile(map, FILE_MAP_READ, 0, alignedOffset,
                                 sizeof(T) + (offset - alignedOffset));
 
-    mMappedView = reinterpret_cast<T*>((char*)mRealView + (offset - alignedOffset));
+    mMappedView = mRealView ? reinterpret_cast<T*>((char*)mRealView + (offset - alignedOffset)) :
+                              nsnull;
   }
   ~RVAMap() {
     if (mRealView) {
       ::UnmapViewOfFile(mRealView);
     }
   }
   operator const T*() const { return mMappedView; }
   const T* operator->() const { return mMappedView; }