diff options
author | José Fonseca <[email protected]> | 2011-03-31 14:40:25 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2011-04-01 20:18:18 +0100 |
commit | 3733da31e8b4405b65e1b6ca3b6599ecc5af5fe7 (patch) | |
tree | 48e13947e294409416ddfa27f0f3458bf8bb54f9 /src/gallium/auxiliary/draw/draw_pt.c | |
parent | 4a7f013f9db793dab8dbc9f71646dab49f12ed2f (diff) |
draw: Prevent out-of-bounds vertex buffer access.
Based on some code and ideas from Keith Whitwell.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index c3d7e871f7a..e0eda67c1a2 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -470,6 +470,17 @@ draw_vbo(struct draw_context *draw, if (0) draw_print_arrays(draw, info->mode, info->start, MIN2(info->count, 20)); + draw->pt.max_index = util_draw_max_index(draw->pt.vertex_buffer, + draw->pt.nr_vertex_buffers, + draw->pt.vertex_element, + draw->pt.nr_vertex_elements, + info); + + /* + * TODO: We could use draw->pt.max_index to further narrow + * the min_index/max_index hints given by the state tracker. + */ + for (instance = 0; instance < info->instance_count; instance++) { draw->instance_id = instance + info->start_instance; |