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_private.h | |
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_private.h')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_private.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index db2e3c5410d..b7d693f8584 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -146,6 +146,14 @@ struct draw_context struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; unsigned nr_vertex_buffers; + /* + * This is the largest legal index value for the current set of + * bound vertex buffers. Regardless of any other consideration, + * all vertex lookups need to be clamped to 0..max_index to + * prevent out-of-bound access. + */ + unsigned max_index; + struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; unsigned nr_vertex_elements; |