[PATCH] [glx] Fix a possible null dereference

y y
Sun Dec 6 11:57:09 PST 2009


From: Tomas Carnecky <tom at dbservice.com>

As far as I can see this situation would arise when a window has
a visual ID that is no longer in the screen visual list. I assumed
the BadImplementation error code has been designed for these
or similar situations.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
---

I guess when this situation arises then it would also cause problems
in other parts of the xserver. So if you think it doesn't make sense
to add the check here, feel free to ignore this patch. I already
wrote it when I realized that and since commits are cheap and
send-email so easy to use, here you have it.

 glx/glxcmds.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index eedab65..5404d19 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -120,6 +120,12 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
 	}
     }
 
+    if (!pVisual) {
+        *err = BadImplementation;
+        client->errorValue = vid;
+        return FALSE;
+    }
+
     /* FIXME: What exactly should we check here... */
     if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
 	!(config->drawableType & GLX_WINDOW_BIT)) {
-- 
1.6.5.4




More information about the xorg-devel mailing list