[Mesa-dev] [PATCH 4/8] ddebug: fix use-after-free of streamout targets

Nicolai Hähnle nhaehnle at gmail.com
Mon Nov 13 14:03:32 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Fixes: b47727a83ad6 ("ddebug: implement pipelined hang detection mode")
---
 src/gallium/drivers/ddebug/dd_draw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index a25017114d8..e908410a33d 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -760,21 +760,21 @@ dd_copy_draw_state(struct dd_draw_state *dst, struct dd_draw_state *src)
    } else {
       dst->render_cond.query = NULL;
    }
 
    for (i = 0; i < ARRAY_SIZE(src->vertex_buffers); i++) {
       pipe_vertex_buffer_reference(&dst->vertex_buffers[i],
                                    &src->vertex_buffers[i]);
    }
 
    dst->num_so_targets = src->num_so_targets;
-   for (i = 0; i < ARRAY_SIZE(src->so_targets); i++)
+   for (i = 0; i < src->num_so_targets; i++)
       pipe_so_target_reference(&dst->so_targets[i], src->so_targets[i]);
    memcpy(dst->so_offsets, src->so_offsets, sizeof(src->so_offsets));
 
    for (i = 0; i < PIPE_SHADER_TYPES; i++) {
       if (!src->shaders[i]) {
          dst->shaders[i] = NULL;
          continue;
       }
 
       if (src->shaders[i]) {
-- 
2.11.0



More information about the mesa-dev mailing list