Mesa (master): mesa: check_index_bounds off-by-one fix
Roland Scheidegger
sroland at kemper.freedesktop.org
Mon Feb 6 00:03:04 UTC 2012
Module: Mesa
Branch: master
Commit: 1f4a853b1e4691400ab832c589b044b659c20c06
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f4a853b1e4691400ab832c589b044b659c20c06
Author: Roland Scheidegger <sroland at vmware.com>
Date: Mon Feb 6 01:04:28 2012 +0100
mesa: check_index_bounds off-by-one fix
in check_index_bounds the comparison needs to be "greater equal" since
contrary to the name _MaxElement is the count of the array (this matches
similar code in vbo_exec_DrawRangeElementsBaseVertex).
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/main/api_validate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index b6871d0..1ae491f 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -187,7 +187,7 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
if ((int)(min + basevertex) < 0 ||
- max + basevertex > ctx->Array.ArrayObj->_MaxElement) {
+ max + basevertex >= ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
_mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
max, ctx->Array.ArrayObj->_MaxElement);
More information about the mesa-commit
mailing list