summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-24 12:24:58 +0100
committerKeith Packard <keithp@keithp.com>2010-08-19 18:03:11 -0700
commit7e581780603d6b15291d032efdeeca77f969e0ba (patch)
tree02e800721789121c2e0408a0c95c442f49586850 /glx
parent5725849a1b427cd4a72b84e57f211edb35838718 (diff)
glx: Prevent NULL context deref in __glXGetDrawable() (bug 29184)
During a SwapBuffers request, we may end up querying an unknown drawable outside of an active context, and so need to report this error prior to attempting to dereference the NULL context. Also fixes: [Bug 29184] glXSwapBuffers with no GLX context crashes X. https://bugs.freedesktop.org/show_bug.cgi?id=29184 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9e5b2139e..8d13c1509 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -491,6 +491,13 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
return pGlxDraw;
}
+ /* No active context and an unknown drawable, bail. */
+ if (glxc == NULL) {
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
+ }
+
/* The drawId wasn't a GLX drawable. Make sure it's a window and
* create a GLXWindow for it. Check that the drawable screen
* matches the context screen and that the context fbconfig is