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 92146 e9ea9a71f28ec1c35c225f04bc5717b6b864bf07
parent 92141 11e015ed342e6b8176655d6d1bf0f0bd90789d97
child 92147 4cd50468c3e75f6131c00a0a8db49450253790e7
push id797
push usereakhgari@mozilla.com
push dateMon, 30 Apr 2012 17:05:43 +0000
treeherdermozilla-beta@e9ea9a71f28e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, akeybl
bugs749648
milestone13.0
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
@@ -169,17 +169,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; }