Commit 9b768849 by Merck Hung

Add an argument check for compressed formats in glCompressedTexSubImage2D

The implementation of OpenGLES_v2 glCompressedTexSubImage2D() API lacks of a sanity check for compressed formats. When a non-compressed format is specified (e.g. GL_RGB), an unreachable condition of SS's internal function, ComputeCompressedSize(), is hit. This patch is to add a check in CompressedTexSubImage2D() function to prevent invalid formatd from being entered, in terms of OpenGL_v2 API integrity in accordance with Khorons's specification Bug: b/116776984 Test: Manual tests using OGLESHelloAPI by specifying GL_RGB format Change-Id: Icc964ecb9dbbdef6c6bc82dab42c35290917159e Reviewed-on: https://swiftshader-review.googlesource.com/c/21548Reviewed-by: 's avatarMerck Hung <merckhung@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarMerck Hung <merckhung@google.com>
parent 51814273
...@@ -802,6 +802,11 @@ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yo ...@@ -802,6 +802,11 @@ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yo
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
} }
if(!IsCompressed(format))
{
return error(GL_INVALID_ENUM);
}
if(imageSize != gl::ComputeCompressedSize(width, height, format)) if(imageSize != gl::ComputeCompressedSize(width, height, format))
{ {
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment