diff options
author | Brian Paul <[email protected]> | 2009-05-07 11:01:02 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-05-07 11:01:02 -0600 |
commit | f37cccde3c2f4d63ba45be5b50b2358eb8ef98b4 (patch) | |
tree | eb187a62d6044976b521991bd6db21c0fe783c0c /src/mesa/vbo | |
parent | 6359ecebec860963886801656ab4e01c4e9ff988 (diff) |
vbo: in glDraw[Range]Element() code, check for out of bounds indexes
No-op the bad drawing command rather than go out of bounds and render
garbage. Print a warning to alert the developer to the bad drawing call.
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 0d4cbe9a1e5..f4ad394f516 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -352,6 +352,13 @@ vbo_exec_DrawRangeElements(GLenum mode, if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) return; + if (end >= ctx->Array._MaxElement) { + /* the max element is out of bounds of one or more enabled arrays */ + _mesa_warning(ctx, "glDraw[Range]Elements() index=%u is " + "out of bounds (max=%u)", end, ctx->Array._MaxElement); + return; + } + FLUSH_CURRENT( ctx, 0 ); if (ctx->NewState) |