Validate the combination of type and internal format for CopyTextureCHROMIUM.
Sized internal formats with invalid types would pass validation because
GetInternalFormatInfo does not validate that the type is a valid upload
type for the given internal format.
TEST=conformance2/textures/misc/tex-image-with-bad-args-from-dom-elements.html
BUG=angleproject:1932
Change-Id: I07fd542630a4508383263c1fe3d7a80c037d7ca0
Reviewed-on: https://chromium-review.googlesource.com/617508
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 5dfa4ef..8238df2 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -290,6 +290,13 @@
return false;
}
+ if (!ValidES3FormatCombination(GetUnsizedFormat(internalFormat), type, internalFormat))
+ {
+ context->handleError(InvalidOperation()
+ << "Invalid combination of type and internalFormat.");
+ return false;
+ }
+
const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, type);
if (!internalFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{