summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-01-17 18:21:00 -0700
committerBrian <brian@yutani.localnet.net>2007-01-17 18:21:00 -0700
commit272622a2e016c2e378efd64f22b5e37e342a1f48 (patch)
treeb462afcf75f65af2acedee9f9f8aa12876693da8 /src/mesa/shader
parent2585b74e190585962da6f0a67c3b1ce830009f82 (diff)
do bounds check in _slang_push_var_table(), added comment
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/slang/slang_vartable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c
index f9121f740b..6d2b4369d9 100644
--- a/src/mesa/shader/slang/slang_vartable.c
+++ b/src/mesa/shader/slang/slang_vartable.c
@@ -32,6 +32,8 @@ struct slang_var_table_
/**
* Create new table, put at head, return ptr to it.
+ * XXX we should take a maxTemps parameter to indicate how many temporaries
+ * are available for the current shader/program target.
*/
slang_var_table *
_slang_push_var_table(slang_var_table *parent)
@@ -139,7 +141,7 @@ alloc_reg(slang_var_table *t, GLint size, GLboolean isTemp)
for (i = 0; i < MAX_PROGRAM_TEMPS; i++) {
GLuint found = 0;
for (j = 0; j < sz4; j++) {
- if (!t->temps[i + j]) {
+ if (i + j < MAX_PROGRAM_TEMPS && !t->temps[i + j]) {
found++;
}
else {