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 <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14857>
(cherry picked from commit 4c76a19ca3)
This commit is contained in:
Mike Blumenkrantz 2022-01-28 09:46:47 -05:00 committed by Eric Engestrom
parent 35f4051a90
commit 752af7467e
2 changed files with 4 additions and 4 deletions

View file

@ -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
},

View file

@ -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);
}