Module: Mesa
Branch: master
Commit: dd245016657c599ecf24c4abe999319f9c870c47
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd245016657c599ecf24c4abe999319f9c870c47

Author: Ian Romanick <[email protected]>
Date:   Tue Oct 20 10:58:14 2009 -0700

ARB prog parser: Fix parameter array size comparison

Array indexes are invalid when >= the maximum, but array sizes are
only in valid when > the maximum.  This prevented programs from
declaring a single maximum size array.

See the piglit vp-max-array test.

---

 src/mesa/shader/program_parse.tab.c |    2 +-
 src/mesa/shader/program_parse.y     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/shader/program_parse.tab.c 
b/src/mesa/shader/program_parse.tab.c
index 9f2d4de..c255e91 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/shader/program_parse.tab.c
@@ -3109,7 +3109,7 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 1041 "program_parse.y"
     {
-          if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - 
(1)].integer) >= state->limits->MaxParameters)) {
+          if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - 
(1)].integer) > state->limits->MaxParameters)) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array 
size");
              YYERROR;
           } else {
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y
index 06c1915..ae9e15a 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/shader/program_parse.y
@@ -1039,7 +1039,7 @@ optArraySize:
        }
        | INTEGER
         {
-          if (($1 < 1) || ((unsigned) $1 >= state->limits->MaxParameters)) {
+          if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) {
              yyerror(& @1, state, "invalid parameter array size");
              YYERROR;
           } else {

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to