Bug 802778 - Validate level parameter in copyTexImage2D. r=jgilbert, a=lsblakk
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -891,16 +891,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)) {