From: Marek Olšák Date: Tue, 22 Jun 2010 22:20:11 +0000 (+0200) Subject: r300g: index buffer range checking X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d84bf6d44dcac8cf8babb6ddce05cbc8f76db24c;p=mesa.git r300g: index buffer range checking --- diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 4afd124c0eb..0fd05b51ac1 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -508,6 +508,12 @@ static void r300_draw_range_elements(struct pipe_context* pipe, return; } + /* Index buffer range checking. */ + if ((start + count) * indexSize > indexBuffer->width0) { + fprintf(stderr, "r300: Invalid index buffer range. Skipping rendering.\n"); + return; + } + /* Set up fallback for incompatible vertex layout if needed. */ if (r300->incompatible_vb_layout || r300->velems->incompatible_layout) { r300_begin_vertex_translate(r300);