Bug 1325500 - Require size=4 for packed int types. - r=daoshengmu draft
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 22 Dec 2016 16:07:26 -0800
changeset 453210 73fe2100ac25597b4427535a252c9a1b9a5e17a0
parent 453209 1a0b7acb6385e199b1baebc2d72b167da3c3ab5f
child 453224 aec01ecea70d20a1c9d80778e66eeb5ac303f367
push id39595
push userbmo:jgilbert@mozilla.com
push dateFri, 23 Dec 2016 00:08:09 +0000
reviewersdaoshengmu
bugs1325500
milestone53.0a1
Bug 1325500 - Require size=4 for packed int types. - r=daoshengmu MozReview-Commit-ID: DXtxRGTjR8x
dom/canvas/WebGLContextValidate.cpp
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -357,16 +357,26 @@ WebGLContext::ValidateAttribPointer(bool
     MOZ_ASSERT(IsPowerOfTwo(requiredAlignment));
     GLsizei requiredAlignmentMask = requiredAlignment - 1;
 
     if (size < 1 || size > 4) {
         ErrorInvalidValue("%s: invalid element size", info);
         return false;
     }
 
+    switch (type) {
+    case LOCAL_GL_INT_2_10_10_10_REV:
+    case LOCAL_GL_UNSIGNED_INT_2_10_10_10_REV:
+        if (size != 4) {
+            ErrorInvalidOperation("%s: size must be 4 for this type.", info);
+            return false;
+        }
+        break;
+    }
+
     // see WebGL spec section 6.6 "Vertex Attribute Data Stride"
     if (stride < 0 || stride > 255) {
         ErrorInvalidValue("%s: negative or too large stride", info);
         return false;
     }
 
     if (byteOffset < 0) {
         ErrorInvalidValue("%s: negative offset", info);