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 <erik.faye-lund@collabora.com>
Reviewed-by: Guillaume Charifi <guillaume.charifi@sfr.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Erik Faye-Lund 2018-09-20 09:21:38 +01:00
parent dd333c66bd
commit c3486cd8c9
1 changed files with 2 additions and 1 deletions

View File

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