Bug 1316539 - Do null TexSubImage check with blob->HasData(). - r=lenzak800 draft
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 19 Dec 2016 17:43:12 -0800
changeset 451217 7fbaab866ecf13c304bd85242e088fc9dd947d92
parent 451111 d4b3146a5567a7ddbcdfa5244945db55616cb8d1
child 451225 c22f2d4e1e07f72d38154b8b93d6e56c8b82f5ce
child 451330 24594f17c7fc989b468eb0128637aae34c7c0e3d
push id39100
push userbmo:jgilbert@mozilla.com
push dateTue, 20 Dec 2016 01:43:48 +0000
reviewerslenzak800
bugs1316539
milestone53.0a1
Bug 1316539 - Do null TexSubImage check with blob->HasData(). - r=lenzak800 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,