Bug 1261320 - Check DataSurface is vaild before using, r=milan
authorPeter Chang <pchang@mozilla.com>
Mon, 11 Apr 2016 17:45:09 +0800
changeset 330569 bd8532d1f56bfe0decb405c4bf607b1ae01c17fb
parent 330568 9c35ce0d49ada38c197f0ffaca026b3f66382c95
child 330570 f7bde8dff75c4f68846e5a5d863f46152fb1fceb
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1261320
milestone48.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 1261320 - Check DataSurface is vaild before using, r=milan MozReview-Commit-ID: 1uhNttyNAiq
dom/canvas/TexUnpackBlob.cpp
--- a/dom/canvas/TexUnpackBlob.cpp
+++ b/dom/canvas/TexUnpackBlob.cpp
@@ -751,17 +751,23 @@ TexUnpackSurface::TexOrSubImage(bool isS
 
     WebGLContext* webgl = tex->mContext;
 
     // MakeCurrent is a big mess in here, because mapping (and presumably unmapping) on
     // OSX can lose our MakeCurrent. Therefore it's easiest to MakeCurrent just before we
     // call into GL, instead of trying to keep MakeCurrent-ed.
 
     RefPtr<gfx::DataSourceSurface> dataSurf = mSurf->GetDataSurface();
-    MOZ_ASSERT(dataSurf);
+
+    if (!dataSurf) {
+        // Since GetDataSurface didn't return error code, assume system
+        // is out of memory
+        *out_glError = LOCAL_GL_OUT_OF_MEMORY;
+        return;
+    }
 
     GLenum error;
     if (UploadDataSurface(isSubImage, webgl, target, level, dui, xOffset, yOffset,
                           zOffset, mWidth, mHeight, dataSurf, mIsAlphaPremult, &error))
     {
         return;
     }
     if (error == LOCAL_GL_OUT_OF_MEMORY) {