summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2012-08-03 23:51:34 -0700
committerVinson Lee <[email protected]>2012-08-04 21:42:23 -0700
commit61b62c007a7941e9b45e83440e932160a597e0e1 (patch)
tree01d9a1606fbd64f2fb273017176333d65038aa4d
parent3e7b3a04bf7667583dac18f1267d213aa7f33800 (diff)
mesa: Fix off-by-one error in Parse_TextureImageId.
Fixes out-of-bounds write defect reported by Coverity. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/mesa/program/nvfragparse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/program/nvfragparse.c b/src/mesa/program/nvfragparse.c
index bcc553a9bc6..20c8579b08b 100644
--- a/src/mesa/program/nvfragparse.c
+++ b/src/mesa/program/nvfragparse.c
@@ -582,7 +582,7 @@ Parse_TextureImageId(struct parse_state *parseState,
RETURN_ERROR1("Expected TEX# source");
}
unit = atoi((const char *) imageSrc + 3);
- if ((unit < 0 || unit > MAX_TEXTURE_IMAGE_UNITS) ||
+ if ((unit < 0 || unit >= MAX_TEXTURE_IMAGE_UNITS) ||
(unit == 0 && (imageSrc[3] != '0' || imageSrc[4] != 0))) {
RETURN_ERROR1("Invalied TEX# source index");
}