From d84bf6d44dcac8cf8babb6ddce05cbc8f76db24c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 23 Jun 2010 00:20:11 +0200 Subject: [PATCH] r300g: index buffer range checking --- src/gallium/drivers/r300/r300_render.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.30.2