ddebug: fix use-after-free of streamout targets
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 10 Nov 2017 12:11:53 +0000 (13:11 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 20 Nov 2017 17:16:00 +0000 (18:16 +0100)
Fixes: b47727a83ad6 ("ddebug: implement pipelined hang detection mode")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/ddebug/dd_draw.c

index a25017114d8ac4e1c0beeb54b81e755c2c8f5a18..e908410a33ddc34525479c247ec3be6d61a90497 100644 (file)
@@ -767,7 +767,7 @@ dd_copy_draw_state(struct dd_draw_state *dst, struct dd_draw_state *src)
    }
 
    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));