Commit d62eca33 by Nicolas Capens

Validate vertex element sizes.

Change-Id: I03fabec6a92ef058aa2968418755aca079598cfe Reviewed-on: https://swiftshader-review.googlesource.com/3781Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 345084ed
...@@ -680,6 +680,11 @@ void ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ...@@ -680,6 +680,11 @@ void ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer
{ {
TRACE("(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = %p)", size, type, stride, pointer); TRACE("(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = %p)", size, type, stride, pointer);
if(size != 4)
{
return error(GL_INVALID_VALUE);
}
VertexAttribPointer(sw::Color0, size, type, true, stride, pointer); VertexAttribPointer(sw::Color0, size, type, true, stride, pointer);
} }
...@@ -2857,6 +2862,11 @@ void PointSize(GLfloat size) ...@@ -2857,6 +2862,11 @@ void PointSize(GLfloat size)
{ {
TRACE("(GLfloat size = %f)", size); TRACE("(GLfloat size = %f)", size);
if(size <= 0)
{
return error(GL_INVALID_VALUE);
}
es1::Context *context = es1::getContext(); es1::Context *context = es1::getContext();
if(context) if(context)
...@@ -3185,6 +3195,11 @@ void TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *poin ...@@ -3185,6 +3195,11 @@ void TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *poin
{ {
TRACE("(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = %p)", size, type, stride, pointer); TRACE("(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = %p)", size, type, stride, pointer);
if(size < 2 || size > 4)
{
return error(GL_INVALID_VALUE);
}
es1::Context *context = es1::getContext(); es1::Context *context = es1::getContext();
if(context) if(context)
...@@ -4108,6 +4123,11 @@ void VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointe ...@@ -4108,6 +4123,11 @@ void VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointe
{ {
TRACE("(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = %p)", size, type, stride, pointer); TRACE("(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid *pointer = %p)", size, type, stride, pointer);
if(size < 2 || size > 4)
{
return error(GL_INVALID_VALUE);
}
VertexAttribPointer(sw::Position, size, type, false, stride, pointer); VertexAttribPointer(sw::Position, size, type, false, stride, pointer);
} }
......
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