From 752af7467e73f160b634e07dfe5bc3ea8a251503 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 28 Jan 2022 09:46:47 -0500 Subject: [PATCH] llvmpipe: fix debug print iterating in set_framebuffer_state this would potentially access garbage memory by checking the existing state using the incoming state's iterator values cc: mesa-stable Reviewed-by: Dave Airlie Part-of: (cherry picked from commit 4c76a19ca35ded99a2f13eef59a0cd161e3c43b0) --- .pick_status.json | 2 +- src/gallium/drivers/llvmpipe/lp_state_surface.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index dc727901bcf..df42f25d576 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1156,7 +1156,7 @@ "description": "llvmpipe: fix debug print iterating in set_framebuffer_state", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c index 9c698383ecc..58aea7bed11 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -67,13 +67,13 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, const struct util_format_description *depth_desc = util_format_description(depth_format); - if (lp->framebuffer.zsbuf && lp->framebuffer.zsbuf->context != pipe) { + if (fb->zsbuf && fb->zsbuf->context != pipe) { debug_printf("Illegal setting of fb state with zsbuf created in " "another context\n"); } for (i = 0; i < fb->nr_cbufs; i++) { - if (lp->framebuffer.cbufs[i] && - lp->framebuffer.cbufs[i]->context != pipe) { + if (fb->cbufs[i] && + fb->cbufs[i]->context != pipe) { debug_printf("Illegal setting of fb state with cbuf %d created in " "another context\n", i); }