glCompressedTexSub* validation fixes
- Added imageSize validation checks
- Added ETC2/EAC specific validations
Change-Id: I8671b08caecb7aaff0b42d6843d31738b54d0f5a
Reviewed-on: https://swiftshader-review.googlesource.com/14088
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cpp b/src/OpenGL/libGLESv2/libGLESv2.cpp
index 2ba9176..2ad5717 100644
--- a/src/OpenGL/libGLESv2/libGLESv2.cpp
+++ b/src/OpenGL/libGLESv2/libGLESv2.cpp
@@ -947,9 +947,9 @@
return error(validationError);
}
- if(width == 0 || height == 0)
+ if(imageSize != egl::ComputeCompressedSize(width, height, format))
{
- return;
+ return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
@@ -6578,9 +6578,9 @@
return error(validationError);
}
- if(width == 0 || height == 0 || depth == 0)
+ if(imageSize != egl::ComputeCompressedSize(width, height, format) * depth)
{
- return;
+ return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();