Bug 802778 - Validate level parameter in copyTexImage2D. r=jgilbert, a=lsblakk
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 09 Nov 2012 16:48:54 -0500
changeset 114087 1e01edd1a7a1daacd8a924531c6e3ac53a9e23fc
parent 114086 b05679d0dc77b0a207902aa2c7e48c09ebc7f63b
child 114088 277b5640ca6a86c14dc7977080f9318484ba3cbc
push id2642
push userryanvm@gmail.com
push dateSat, 10 Nov 2012 03:24:35 +0000
treeherdermozilla-aurora@424e76e7dc62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, lsblakk
bugs802778
milestone18.0a2
Bug 802778 - Validate level parameter in copyTexImage2D. r=jgilbert, a=lsblakk
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -666,16 +666,20 @@ WebGLContext::CopyTexSubImage2D_base(Web
                                      bool sub)
 {
     const WebGLRectangleObject *framebufferRect = FramebufferRectangleObject();
     WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
     WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
 
     const char *info = sub ? "copyTexSubImage2D" : "copyTexImage2D";
 
+    if (!ValidateLevelWidthHeightForTarget(target, level, width, height, info)) {
+        return;
+    }
+
     MakeContextCurrent();
 
     WebGLTexture *tex = activeBoundTextureForTarget(target);
 
     if (!tex)
         return ErrorInvalidOperation("%s: no texture is bound to this target");
 
     if (CanvasUtils::CheckSaneSubrectSize(x, y, width, height, framebufferWidth, framebufferHeight)) {