Bug 1230929 - modified the logic in order to prvent null pointer dereference. r=jmuizelaar
authorBogdan Postelnicu <bogdan.postelnicu>
Mon, 07 Dec 2015 07:36:00 +0100
changeset 310037 0f9e4f23c1e66474f5ea12d9f14a1aa1209526d4
parent 310036 a52f9890e2e1b5419d267a71b36205c716fa08da
child 310038 7e09a6ccc9d5b9927194ede8de05ac726de53bca
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar
bugs1230929
milestone45.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 1230929 - modified the logic in order to prvent null pointer dereference. r=jmuizelaar
gfx/thebes/gfxASurface.cpp
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -203,19 +203,20 @@ gfxASurface::Wrap (cairo_surface_t *csur
 
     return result.forget();
 }
 
 void
 gfxASurface::Init(cairo_surface_t* surface, bool existingSurface)
 {
     SetSurfaceWrapper(surface, this);
+    MOZ_ASSERT(surface, "surface should be a valid pointer");
 
     mSurface = surface;
-    mSurfaceValid = surface && !cairo_surface_status(surface);
+    mSurfaceValid = !cairo_surface_status(surface);
     if (!mSurfaceValid) {
         gfxWarning() << "ASurface Init failed with Cairo status " << cairo_surface_status(surface) << " on " << hexa(surface);
     }
 
     if (existingSurface || !mSurfaceValid) {
         mFloatingRefs = 0;
     } else {
         mFloatingRefs = 1;