glsl: Fix array out-of-bounds access by _slang_lookup_constant.

This commit is contained in:
Vinson Lee 2009-12-10 12:37:10 -08:00
parent dcb4a37fc8
commit 51f52edaf1
1 changed files with 5 additions and 4 deletions

View File

@ -84,10 +84,11 @@ _slang_lookup_constant(const char *name)
for (i = 0; info[i].Name; i++) {
if (strcmp(info[i].Name, name) == 0) {
/* found */
GLint value = -1;
_mesa_GetIntegerv(info[i].Token, &value);
ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
return value;
GLint values[4];
values[0] = -1;
_mesa_GetIntegerv(info[i].Token, values);
ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */
return values[0];
}
}
return -1;