[Mesa-dev] [PATCH] st/mesa: do not call update_framebuffer_size with NULL pointer

Marek Olšák maraeo at gmail.com
Tue Sep 25 00:50:55 UTC 2018


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Sep 20, 2018 at 4:27 AM, Erik Faye-Lund
<erik.faye-lund at collabora.com> wrote:
> 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 at collabora.com>
> ---
>  src/mesa/state_tracker/st_atom_framebuffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
> index 807c312a5d..a0dd0d1f64 100644
> --- a/src/mesa/state_tracker/st_atom_framebuffer.c
> +++ b/src/mesa/state_tracker/st_atom_framebuffer.c
> @@ -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;
> --
> 2.17.1
>


More information about the mesa-dev mailing list