Bug 1289653 - Disallow null `pixels` in texSubImage. - r=mtseng draft
authorJeff Gilbert <jgilbert@mozilla.com>
Tue, 26 Jul 2016 19:49:33 -0700
changeset 393137 d3de9fa5cb6c47a1298a3f0ff167b3cbb97bf881
parent 393135 2da7497fc16b48c108506c5c2d64ea13b9fa8dc8
child 526503 6872cbe37ffbf6a8c9a04a666d559415354c483d
push id24223
push userbmo:jgilbert@mozilla.com
push dateWed, 27 Jul 2016 02:49:35 +0000
reviewersmtseng
bugs1289653
milestone50.0a1
Bug 1289653 - Disallow null `pixels` in texSubImage. - r=mtseng MozReview-Commit-ID: HgbJEhykEda
dom/canvas/WebGLTextureUpload.cpp
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -257,16 +257,19 @@ WebGLTexture::TexOrSubImage(bool isSubIm
         }
 
         if (width && height && depth) {
             view.ComputeLengthAndData();
 
             bytes = view.DataAllowShared();
             byteCount = view.LengthAllowShared();
         }
+    } else if (isSubImage) {
+        mContext->ErrorInvalidValue("%s: `pixels` must not be null.", funcName);
+        return;
     }
 
     const bool isClientData = true;
     webgl::TexUnpackBytes blob(mContext, target, width, height, depth, isClientData,
                                bytes);
 
     if (bytes &&
         !ValidateUnpackBytes(mContext, funcName, width, height, depth, pi, byteCount,