Added proper size/offset checks glTexSubImage3D and glCopyTexSubImage3D were missing some validity checks for size and offset parameters. Change-Id: Iff1aa034318c1fc58f9bb433c61bd8623493604a Reviewed-on: https://swiftshader-review.googlesource.com/3602 Tested-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLESv2/libGLESv3.cpp b/src/OpenGL/libGLESv2/libGLESv3.cpp index 5a90245..e1cef90 100644 --- a/src/OpenGL/libGLESv2/libGLESv3.cpp +++ b/src/OpenGL/libGLESv2/libGLESv3.cpp
@@ -642,7 +642,7 @@ return error(GL_INVALID_VALUE); } - if((width < 0) || (height < 0) || (depth < 0)) + if((width < 0) || (height < 0) || (depth < 0) || (xoffset < 0) || (yoffset < 0) || (zoffset < 0)) { return error(GL_INVALID_VALUE); } @@ -680,6 +680,11 @@ return error(GL_INVALID_VALUE); } + if((width < 0) || (height < 0) || (xoffset < 0) || (yoffset < 0) || (zoffset < 0)) + { + return error(GL_INVALID_VALUE); + } + es2::Context *context = es2::getContext(); if(context)