Commit e5d01414 by Nicolas Capens

Add missing validation for negative GLsizei values.

Change-Id: Id3022059b3d5c21e5c78c668e21fddf569d920ef Reviewed-on: https://swiftshader-review.googlesource.com/3760Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 769783ca
...@@ -2891,6 +2891,11 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei unifor ...@@ -2891,6 +2891,11 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei unifor
return error(GL_INVALID_ENUM); return error(GL_INVALID_ENUM);
} }
if(uniformCount < 0)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext(); es2::Context *context = es2::getContext();
if(context) if(context)
...@@ -2982,6 +2987,11 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint u ...@@ -2982,6 +2987,11 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint u
TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLchar *uniformBlockName = %p)", TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLchar *uniformBlockName = %p)",
program, uniformBlockIndex, bufSize, length, uniformBlockName); program, uniformBlockIndex, bufSize, length, uniformBlockName);
if(bufSize < 0)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext(); es2::Context *context = es2::getContext();
if(context) if(context)
...@@ -3287,6 +3297,11 @@ GL_APICALL void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSi ...@@ -3287,6 +3297,11 @@ GL_APICALL void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSi
TRACE("(GLsync sync = %p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = %p, GLint *values = %p)", TRACE("(GLsync sync = %p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = %p, GLint *values = %p)",
sync, pname, bufSize, length, values); sync, pname, bufSize, length, values);
if(bufSize < 0)
{
return error(GL_INVALID_VALUE);
}
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
...@@ -3762,6 +3777,11 @@ GL_APICALL void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize, ...@@ -3762,6 +3777,11 @@ GL_APICALL void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize,
TRACE("(GLuint program = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLenum *binaryFormat = %p, void *binary = %p)", TRACE("(GLuint program = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLenum *binaryFormat = %p, void *binary = %p)",
program, bufSize, length, binaryFormat, binary); program, bufSize, length, binaryFormat, binary);
if(bufSize < 0)
{
return error(GL_INVALID_VALUE);
}
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
...@@ -3770,6 +3790,11 @@ GL_APICALL void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat, ...@@ -3770,6 +3790,11 @@ GL_APICALL void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat,
TRACE("(GLuint program = %d, GLenum binaryFormat = 0x%X, const void *binary = %p, GLsizei length = %d)", TRACE("(GLuint program = %d, GLenum binaryFormat = 0x%X, const void *binary = %p, GLsizei length = %d)",
program, binaryFormat, binaryFormat, length); program, binaryFormat, binaryFormat, length);
if(length < 0)
{
return error(GL_INVALID_VALUE);
}
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
...@@ -3805,6 +3830,11 @@ GL_APICALL void GL_APIENTRY glInvalidateFramebuffer(GLenum target, GLsizei numAt ...@@ -3805,6 +3830,11 @@ GL_APICALL void GL_APIENTRY glInvalidateFramebuffer(GLenum target, GLsizei numAt
TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p)", TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p)",
target, numAttachments, attachments); target, numAttachments, attachments);
if(numAttachments < 0)
{
return error(GL_INVALID_VALUE);
}
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
...@@ -3813,6 +3843,11 @@ GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei nu ...@@ -3813,6 +3843,11 @@ GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei nu
TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", 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); target, numAttachments, attachments, x, y, width, height);
if(numAttachments < 0 || width < 0 || height < 0)
{
return error(GL_INVALID_VALUE);
}
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
......
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