Bug 1316539 - Do null TexSubImage check with blob->HasData(). - r=lenzak800. a=gchang
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 19 Dec 2016 17:43:12 -0800
changeset 353131 62eb5ff8893e7803da94b2e52bd108285aa1f5fe
parent 353130 617286d6483d74081fdb9fc001bed23b002a1ffe
child 353132 8255a7049f448df8fe5154fdfe0aa5248684f164
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslenzak800, gchang
bugs1316539
milestone52.0a2
Bug 1316539 - Do null TexSubImage check with blob->HasData(). - r=lenzak800. a=gchang MozReview-Commit-ID: LwRZQI2dcKO
dom/canvas/WebGLTextureUpload.cpp
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -439,16 +439,21 @@ WebGLTexture::TexSubImage(const char* fu
 {
     const GLint border = 0;
     dom::RootedTypedArray<dom::Uint8ClampedArray> scopedArr(dom::RootingCx());
     const auto blob = ValidateTexOrSubImage(mContext, funcName, target, width, height,
                                             depth, border, pi, src, &scopedArr);
     if (!blob)
         return;
 
+    if (!blob->HasData()) {
+        mContext->ErrorInvalidValue("%s: Source must not be null.", funcName);
+        return;
+    }
+
     TexSubImage(funcName, target, level, xOffset, yOffset, zOffset, pi, blob.get());
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////
 
 static bool
 ValidateTexImage(WebGLContext* webgl, WebGLTexture* texture, const char* funcName,