diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-01-27 11:58:41 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2017-03-14 00:13:14 +0000 |
commit | c974cb118eb7ebb0d8e519fc04b7bd5da8b71767 (patch) | |
tree | 9726556904c78f6ef0ee04f56e50eb7ec8c3bada /src | |
parent | fb58b034348f34c0b491160c379e4c54c805da36 (diff) |
glx/dri3: handle NULL pointers in loader-to-DRI3 drawable conversion
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@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 40c304fc065259c07c0f4f7a35efedd205e4f250)
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/dri3_glx.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 4472a0bed26..f7bcba32f3e 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -81,6 +81,8 @@ 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); } |