Index: Source/WebCore/html/canvas/WebGLRenderingContext.cpp |
=================================================================== |
--- Source/WebCore/html/canvas/WebGLRenderingContext.cpp (revision 145452) |
+++ Source/WebCore/html/canvas/WebGLRenderingContext.cpp (working copy) |
@@ -3708,6 +3708,10 @@ |
Vector<uint8_t> data; |
if (!pixels) |
return; |
+ if (!validateTexFuncFormatAndType("texImage2D", format, type, level)) |
+ return; |
+ if (!validateSettableTexFormat("texImage2D", format)) |
+ return; |
bool needConversion = true; |
// The data from ImageData is always of format RGBA8. |
// No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required. |
@@ -3756,6 +3760,10 @@ |
ec = SECURITY_ERR; |
return; |
} |
+ if (!validateTexFuncFormatAndType("texImage2D", format, type, level)) |
+ return; |
+ if (!validateSettableTexFormat("texImage2D", format)) |
+ return; |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
// If possible, copy from the canvas element directly to the texture |
@@ -3897,6 +3905,10 @@ |
ec = 0; |
if (isContextLost()) |
return; |
+ if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level)) |
+ return; |
+ if (!validateSettableTexFormat("texSubImage2D", format)) |
+ return; |
Vector<uint8_t> data; |
GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE); |
if (!imageExtractor.extractSucceeded()) { |
@@ -3958,6 +3970,10 @@ |
return; |
if (!pixels) |
return; |
+ if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level)) |
+ return; |
+ if (!validateSettableTexFormat("texSubImage2D", format)) |
+ return; |
Vector<uint8_t> data; |
bool needConversion = true; |
// The data from ImageData is always of format RGBA8. |
@@ -4006,6 +4022,10 @@ |
ec = SECURITY_ERR; |
return; |
} |
+ if (!validateTexFuncFormatAndType("texSubImage2D", format, type, level)) |
+ return; |
+ if (!validateSettableTexFormat("texSubImage2D", format)) |
+ return; |
RefPtr<ImageData> imageData = canvas->getImageData(); |
if (imageData) |
texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.get(), ec); |