mesa: test index bounds before array element

Check whether the index is within bounds before accessing the array.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Roel Kluin
2010-01-06 08:27:42 -08:00
committed by Brian Paul
parent 5db710a823
commit 324568f79d
3 changed files with 3 additions and 3 deletions

View File

@@ -642,7 +642,7 @@ Parse_SwizzleSuffix(const GLubyte *token, GLuint swizzle[4])
else {
/* 4-component swizzle (vector) */
GLint k;
for (k = 0; token[k] && k < 4; k++) {
for (k = 0; k < 4 && token[k]; k++) {
if (token[k] == 'x')
swizzle[k] = 0;
else if (token[k] == 'y')