Commit c3486cd8 authored by Erik Faye-Lund 's avatar Erik Faye-Lund

st/mesa: do not call update_framebuffer_size with NULL pointer

In st_renderbuffer_alloc_storage, we avoid allocating storage for
zero-sized buffers, leading to this pointer being NULL. We already
take care to avoid dereferencing these pointers for color-buffers,
but not for depth/stencil-buffers.

So let's thread a bit more carefully here.

This avoids a crash while running Piglit's glx/glx-visuals-stencil
test, both on virgl and r600g.
Signed-off-by: Erik Faye-Lund 's avatarErik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: default avatarGuillaume Charifi <guillaume.charifi@sfr.fr>
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
parent dd333c66
......@@ -181,7 +181,8 @@ st_update_framebuffer_state( struct st_context *st )
st_update_renderbuffer_surface(st, strb);
}
framebuffer.zsbuf = strb->surface;
update_framebuffer_size(&framebuffer, strb->surface);
if (strb->surface)
update_framebuffer_size(&framebuffer, strb->surface);
}
else
framebuffer.zsbuf = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment