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.
This commit is contained in:
José Fonseca
2011-04-06 15:10:19 +01:00
parent aa61b15351
commit 23d75936a7

View File

@@ -943,8 +943,13 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
/* Set 'end' to the max possible legal value */ /* Set 'end' to the max possible legal value */
assert(ctx->Array.ArrayObj->_MaxElement >= 1); assert(ctx->Array.ArrayObj->_MaxElement >= 1);
end = 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}" printf("glDraw[Range]Elements{,BaseVertex}"
"(start %u, end %u, type 0x%x, count %d) ElemBuf %u, " "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
"base %d\n", "base %d\n",