Mesa (mesa_7_6_branch): glsl: Fix array out-of-bounds access by _slang_lookup_constant.

Vinson Lee vlee at kemper.freedesktop.org
Thu Dec 10 20:38:29 UTC 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 51f52edaf186a927a2c8c29ba9dba56d18928a7e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=51f52edaf186a927a2c8c29ba9dba56d18928a7e

Author: Vinson Lee <vlee at vmware.com>
Date:   Thu Dec 10 12:37:10 2009 -0800

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

---

 src/mesa/shader/slang/slang_simplify.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c
index b8a21f6..539c6ff 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/shader/slang/slang_simplify.c
@@ -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;




More information about the mesa-commit mailing list