Bug 1156980 - Validate target in ImageData variants of TexImage2D/TexSubImage2D. r=jgilbert

This commit is contained in:
Dan Glastonbury 2015-04-22 23:39:00 +02:00
parent ec963b4d8e
commit 29f0f96441
2 changed files with 11 additions and 2 deletions

View File

@ -637,6 +637,10 @@ public:
GLint yoffset, GLenum format, GLenum type,
ElementType& elt, ErrorResult& rv)
{
// TODO: Consolidate all the parameter validation
// checks. Instead of spreading out the cheks in multple
// places, consolidate into one spot.
if (IsContextLost())
return;
@ -1308,7 +1312,7 @@ protected:
GLenum format, GLenum type, void* data,
uint32_t byteLength, js::Scalar::Type jsArrayType,
WebGLTexelFormat srcFormat, bool srcPremultiplied);
void TexSubImage2D_base(TexImageTarget texImageTarget, GLint level,
void TexSubImage2D_base(GLenum texImageTarget, GLint level,
GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLsizei srcStrideOrZero,
GLenum format, GLenum type, void* pixels,

View File

@ -3423,7 +3423,7 @@ WebGLContext::TexImage2D(GLenum rawTarget, GLint level,
void
WebGLContext::TexSubImage2D_base(TexImageTarget texImageTarget, GLint level,
WebGLContext::TexSubImage2D_base(GLenum rawImageTarget, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLsizei srcStrideOrZero,
GLenum format, GLenum type,
@ -3437,6 +3437,11 @@ WebGLContext::TexSubImage2D_base(TexImageTarget texImageTarget, GLint level,
if (type == LOCAL_GL_HALF_FLOAT_OES)
type = LOCAL_GL_HALF_FLOAT;
if (!ValidateTexImageTarget(rawImageTarget, func, dims))
return;
TexImageTarget texImageTarget(rawImageTarget);
WebGLTexture* tex = ActiveBoundTextureForTexImageTarget(texImageTarget);
if (!tex)
return ErrorInvalidOperation("texSubImage2D: no texture bound on active texture unit");