[Mesa-dev] [PATCH v2 1/4] glx/dri3: handle NULL pointers in loader-to-DRI3 drawable conversion
Nicolai Hähnle
nhaehnle at gmail.com
Thu Feb 2 17:19:25 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
With a subsequent patch, we might see 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>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
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.9.3
More information about the mesa-dev
mailing list