summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-04-06 15:10:19 +0100
committerJosé Fonseca <[email protected]>2011-04-07 12:20:06 +0100
commit23d75936a72b9a9b9e1d04a901a86a75d93dbffb (patch)
tree1a4fd3e3a1f4da4c13305488a608b7890caa20ad
parentaa61b1535187129c61dd772471f23c633971665d (diff)
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.
-rw-r--r--src/mesa/vbo/vbo_exec_array.c7
1 files changed, 6 insertions, 1 deletions
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",