]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-base/xorg-server/files/0001-glx-Prevent-NULL-context-deref-in-__glXGetDrawable.patch
90bef52a3704508c13aba43b3a15eb102512942b
[gentoo-draconx.git] / x11-base / xorg-server / files / 0001-glx-Prevent-NULL-context-deref-in-__glXGetDrawable.patch
1 From a59c7428549c8be0724bcfceecd596582840852b Mon Sep 17 00:00:00 2001
2 From: Chris Wilson <chris@chris-wilson.co.uk>
3 Date: Thu, 24 Jun 2010 12:24:58 +0100
4 Subject: [PATCH] glx: Prevent NULL context deref in __glXGetDrawable()
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 During a SwapBuffers request, we may end up querying an unknown drawable
10 outside of an active context, and so need to report this error prior to
11 attempting to dereference the NULL context.
12
13 Also fixes:
14
15   [Bug 29184] glXSwapBuffers with no GLX context crashes X.
16   https://bugs.freedesktop.org/show_bug.cgi?id=29184
17
18 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
19 Cc: Kristian Høgsberg <krh@bitplanet.net>
20 ---
21  glx/glxcmds.c |    7 +++++++
22  1 files changed, 7 insertions(+), 0 deletions(-)
23
24 diff --git a/glx/glxcmds.c b/glx/glxcmds.c
25 index 9e5b213..8d13c15 100644
26 --- a/glx/glxcmds.c
27 +++ b/glx/glxcmds.c
28 @@ -491,6 +491,13 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
29         return pGlxDraw;
30      }
31  
32 +    /* No active context and an unknown drawable, bail. */
33 +    if (glxc == NULL) {
34 +           client->errorValue = drawId;
35 +           *error = BadMatch;
36 +           return NULL;
37 +    }
38 +
39      /* The drawId wasn't a GLX drawable.  Make sure it's a window and
40       * create a GLXWindow for it.  Check that the drawable screen
41       * matches the context screen and that the context fbconfig is
42 -- 
43 1.7.1
44