[Mesa-dev] [PATCH 2/2] glx/dri3: handle NULL pointers in loader-to-DRI3 drawable conversion
Marek Olšák
maraeo at gmail.com
Mon Jan 30 12:11:08 UTC 2017
For the series:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Fri, Jan 27, 2017 at 11:59 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> With the previous patch, we can now get NULL loaderPrivates, e.g. when
> a DRIdrawable is flushed whose corresponding GLXDRIdrawable was destroyed.
> This resulted in a crash, since the loader vs. DRI3 drawable structures
> have a non-zero offset.
>
> Fixes glx-visuals-depth/stencil -pixmap
>
> Cc: 17.0 <mesa-stable at lists.freedesktop.org>
> ---
> src/glx/dri3_glx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index 4472a0b..f7bcba3 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -74,20 +74,22 @@
> #include <sys/time.h>
>
> #include "dri_common.h"
> #include "dri3_priv.h"
> #include "loader.h"
> #include "dri2.h"
>
> static struct dri3_drawable *
> loader_drawable_to_dri3_drawable(struct loader_dri3_drawable *draw) {
> size_t offset = offsetof(struct dri3_drawable, loader_drawable);
> + if (!draw)
> + return NULL;
> return (struct dri3_drawable *)(((void*) draw) - offset);
> }
>
> static int
> glx_dri3_get_swap_interval(struct loader_dri3_drawable *draw)
> {
> struct dri3_drawable *priv = loader_drawable_to_dri3_drawable(draw);
>
> return priv->swap_interval;
> }
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list