Mesa (master): mesa: Fix off-by-one error in Parse_TextureImageId.
Vinson Lee
vlee at kemper.freedesktop.org
Sun Aug 5 04:42:48 UTC 2012
Module: Mesa
Branch: master
Commit: 61b62c007a7941e9b45e83440e932160a597e0e1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=61b62c007a7941e9b45e83440e932160a597e0e1
Author: Vinson Lee <vlee at freedesktop.org>
Date: Fri Aug 3 23:51:34 2012 -0700
mesa: Fix off-by-one error in Parse_TextureImageId.
Fixes out-of-bounds write defect reported by Coverity.
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/mesa/program/nvfragparse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mesa/program/nvfragparse.c b/src/mesa/program/nvfragparse.c
index bcc553a..20c8579 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");
}
More information about the mesa-commit
mailing list