http://bugs.freedesktop.org/show_bug.cgi?id=22546
Summary: GetGLXScreenConfigs() segfaults if GLX isn't present.
Product: Mesa
Version: unspecified
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: GLX
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=27243)
--> (http://bugs.freedesktop.org/attachment.cgi?id=27243)
Patch to fix GetGLXScreenConfigs().
While testing rendering fallback functionality in an application that supports
both OpenGL and software rendering, I discovered a bug in Mesa that causes the
program to crash if it's running on an X server that doesn't support GLX at all
(e.g. vncserver).
A backtrace reveals the source:
#0 GetGLXScreenConfigs (dpy=<value optimized out>, scrn=0) at glxcmds.c:167
priv = (__GLXdisplayPrivate * const) 0x0
#1 0xb7a40fa7 in CreateContext (dpy=0x9c3ad98, vis=<value optimized out>,
fbconfig=0x0, shareList=0x0, allowDirect=1, contextID=0, use_glx_1_3=0,
renderType=0) at glxcmds.c:364
gc = (GLXContext) 0xb79e2ff4
screen = -1208638311
psc = <value optimized out>
#2 0xb7a415c0 in glXCreateContext (dpy=0x9c3ad98, vis=0x99ce4c0,
shareList=0x0, allowDirect=1) at glxcmds.c:487
The GetGLXScreenConfigs() function is as follows:
static __GLXscreenConfigs *
GetGLXScreenConfigs(Display *dpy, int scrn)
{
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
return (priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL;
}
__glXInitialize() returns NULL because the X server doesn't support GLX;
however, the following statement doesn't check if priv is NULL, which results
in a null pointer dereference. The solution is to check both priv and
priv->screenConfigs for NULL.
Mesa version is 7.5-rc4.
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev