Mesa (master): softpipe: make sure that invalid calls to sosettargets don' t crash us

Zack Rusin zack at kemper.freedesktop.org
Tue Jun 8 13:19:07 PDT 2010


Module: Mesa
Branch: master
Commit: 38b13459be46bb6d243365d93d4e44ccfa370d69
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=38b13459be46bb6d243365d93d4e44ccfa370d69

Author: Zack Rusin <zack at kde.org>
Date:   Tue Jun  8 16:18:38 2010 -0400

softpipe: make sure that invalid calls to sosettargets don't crash us

---

 src/gallium/drivers/softpipe/sp_state_so.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c
index 8bd20cd..27acd3d 100644
--- a/src/gallium/drivers/softpipe/sp_state_so.c
+++ b/src/gallium/drivers/softpipe/sp_state_so.c
@@ -96,6 +96,13 @@ softpipe_set_stream_output_buffers(struct pipe_context *pipe,
       void *mapped;
       struct softpipe_resource *res = softpipe_resource(buffers[i]);
 
+      if (!res) {
+         /* the whole call is invalid, bail out */
+         softpipe->so_target.num_buffers = 0;
+         draw_set_mapped_so_buffers(softpipe->draw, map_buffers, 0);
+         return;
+      }
+
       softpipe->so_target.buffer[i] = res;
       softpipe->so_target.offset[i] = offsets[i];
       softpipe->so_target.so_count[i] = 0;



More information about the mesa-commit mailing list