Add missing validation for negative GLsizei values.
Change-Id: Id3022059b3d5c21e5c78c668e21fddf569d920ef
Reviewed-on: https://swiftshader-review.googlesource.com/3760
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-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 4def2b2..37e9c30 100644
--- a/src/OpenGL/libGLESv2/libGLESv3.cpp
+++ b/src/OpenGL/libGLESv2/libGLESv3.cpp
@@ -2891,6 +2891,11 @@
return error(GL_INVALID_ENUM);
}
+ if(uniformCount < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
es2::Context *context = es2::getContext();
if(context)
@@ -2982,6 +2987,11 @@
TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLchar *uniformBlockName = %p)",
program, uniformBlockIndex, bufSize, length, uniformBlockName);
+ if(bufSize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
es2::Context *context = es2::getContext();
if(context)
@@ -3287,6 +3297,11 @@
TRACE("(GLsync sync = %p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = %p, GLint *values = %p)",
sync, pname, bufSize, length, values);
+ if(bufSize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
UNIMPLEMENTED();
}
@@ -3762,6 +3777,11 @@
TRACE("(GLuint program = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLenum *binaryFormat = %p, void *binary = %p)",
program, bufSize, length, binaryFormat, binary);
+ if(bufSize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
UNIMPLEMENTED();
}
@@ -3770,6 +3790,11 @@
TRACE("(GLuint program = %d, GLenum binaryFormat = 0x%X, const void *binary = %p, GLsizei length = %d)",
program, binaryFormat, binaryFormat, length);
+ if(length < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
UNIMPLEMENTED();
}
@@ -3805,6 +3830,11 @@
TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p)",
target, numAttachments, attachments);
+ if(numAttachments < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
UNIMPLEMENTED();
}
@@ -3813,6 +3843,11 @@
TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
target, numAttachments, attachments, x, y, width, height);
+ if(numAttachments < 0 || width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
UNIMPLEMENTED();
}