This is the "minimally fix the problem" patch.
>From 6a10c44c58f0366e044e8cbf5acf7f1c14963c7c Mon Sep 17 00:00:00 2001
From: Nathan Kidd <nk...@opentext.com>
Date: Thu, 12 May 2011 16:56:19 -0400
Subject: [PATCH] Don't kill process if glXGetConfig() is fed bad arguments
Prompted by real-world app calling glXGetConfig with a null visual.
Now matches the NVIDIA driver's behaviour. Some Mesa drivers segv.
---
rr/faker-glx.cpp | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/rr/faker-glx.cpp b/rr/faker-glx.cpp
index 2df4b02..0d681d8 100644
--- a/rr/faker-glx.cpp
+++ b/rr/faker-glx.cpp
@@ -254,28 +254,25 @@ int glXGetConfig(Display *dpy, XVisualInfo *vis, int attrib, int *value)
if(!_isremote(dpy)) return _glXGetConfig(dpy, vis, attrib, value);
////////////////////
+ if(!dpy || !vis || !value) return GLX_BAD_VALUE;
+
opentrace(glXGetConfig); prargd(dpy); prargv(vis); prargx(attrib);
starttrace();
- if(vis)
+ int level=__vglClientVisualAttrib(dpy, DefaultScreen(dpy), vis->visualid,
+ GLX_LEVEL);
+ int trans=(__vglClientVisualAttrib(dpy, DefaultScreen(dpy), vis->visualid,
+ GLX_TRANSPARENT_TYPE)==GLX_TRANSPARENT_INDEX);
+ if(level && trans && attrib!=GLX_LEVEL && attrib!=GLX_TRANSPARENT_TYPE)
{
- int level=__vglClientVisualAttrib(dpy, DefaultScreen(dpy), vis->visualid,
- GLX_LEVEL);
- int trans=(__vglClientVisualAttrib(dpy, DefaultScreen(dpy), vis->visualid,
- GLX_TRANSPARENT_TYPE)==GLX_TRANSPARENT_INDEX);
- if(level && trans && attrib!=GLX_LEVEL && attrib!=GLX_TRANSPARENT_TYPE)
- {
- int dummy;
- stoptrace(); if(value) {prargi(*value);} closetrace();
- if(!_XQueryExtension(dpy, "GLX", &dummy, &dummy, &dummy))
- retval=0;
- else retval=_glXGetConfig(dpy, vis, attrib, value);
- return retval;
- }
+ int dummy;
+ stoptrace(); if(value) {prargi(*value);} closetrace();
+ if(!_XQueryExtension(dpy, "GLX", &dummy, &dummy, &dummy))
+ retval=0;
+ else retval=_glXGetConfig(dpy, vis, attrib, value);
+ return retval;
}
- if(!dpy || !value) throw rrerror("glXGetConfig", "Invalid argument");
-
if(!(c=_MatchConfig(dpy, vis))) _throw("Could not obtain Pbuffer-capable RGB visual on the server");
if(attrib==GLX_USE_GL)
--
1.6.3.3
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
VirtualGL-Devel mailing list
VirtualGL-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel