r300g: index buffer range checking
authorMarek Olšák <maraeo@gmail.com>
Tue, 22 Jun 2010 22:20:11 +0000 (00:20 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 22 Jun 2010 22:20:11 +0000 (00:20 +0200)
src/gallium/drivers/r300/r300_render.c

index 4afd124c0eb1fb72d4e67b5af1592a386f66d8a0..0fd05b51ac15357dd6de2e60948c88f92cc5bdab 100644 (file)
@@ -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);