Validate that the format is compressed before calculating data size.
glCompressedTexImage3D was missing a check that the format was valid
before trying to compute the expected data size. This lead to an
assertion failure in the size computation code.
BUG=602737
Change-Id: I74e6ced082e78396a0af92317fb1c0098299a026
Reviewed-on: https://chromium-review.googlesource.com/441185
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index cf368e9..e2384aa 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -1621,6 +1621,12 @@
}
const InternalFormat &formatInfo = GetInternalFormatInfo(format);
+ if (!formatInfo.compressed)
+ {
+ context->handleError(Error(GL_INVALID_ENUM, "Not a valid compressed texture format"));
+ return false;
+ }
+
auto blockSizeOrErr =
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, depth));
if (blockSizeOrErr.isError())