Bug 1261320 - Check DataSurface is vaild before using, r=milan
MozReview-Commit-ID: 1uhNttyNAiq
--- 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) {