draw: don't crash on vertex buffer overflow
authorZack Rusin <zackr@vmware.com>
Thu, 9 May 2013 03:48:20 +0000 (23:48 -0400)
committerZack Rusin <zackr@vmware.com>
Tue, 14 May 2013 07:09:32 +0000 (03:09 -0400)
commit29853ab7b8656cee9b92a53bec43f6e9f1e49691
tree6b4ac7f1accc0358717fe98d6e8b1c5b982baafb
parent386327c48f88b052449afa4f41b1090d3fdb5ce9
draw: don't crash on vertex buffer overflow

We would crash when stride was bigger than the size of the buffer.
The correct behavior is to just fetch zero's in this case.
Unfortunatly with user_buffer's there's no way to validate the size
because currently we're just not getting it. Adjust the draw interface
to pass the size along the mapped buffer, which works perfectly
for buffer backed vertex_buffers and, in future, it will allow
us to plumb user_buffer sizes through the same interface.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
17 files changed:
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm.h
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt_fetch.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
src/gallium/drivers/i915/i915_context.c
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/nv30/nv30_draw.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/softpipe/sp_draw_arrays.c
src/gallium/drivers/svga/svga_swtnl_draw.c
src/mesa/state_tracker/st_draw_feedback.c