From 23d75936a72b9a9b9e1d04a901a86a75d93dbffb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 6 Apr 2011 15:10:19 +0100 Subject: [PATCH] mesa/st: Prevent 'end' < 'start' in vbo_exec_DrawRangeElementsBaseVertex() We adjust 'end' to fit into _MaxElement, but that may result into a 'start' value bigger than 'end' being passed downstream, causing havoc. This could be seen with arb_robustness_draw-vbo-bounds, due to an application bug. --- src/mesa/vbo/vbo_exec_array.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 98d6badc47a..6e26e4e77a0 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -943,8 +943,13 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, /* Set 'end' to the max possible legal value */ assert(ctx->Array.ArrayObj->_MaxElement >= 1); end = ctx->Array.ArrayObj->_MaxElement - 1; + + if (end < start) { + return; + } } - else if (0) { + + if (0) { printf("glDraw[Range]Elements{,BaseVertex}" "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, " "base %d\n", -- 2.30.2