Module: Mesa Branch: master Commit: 76a43c5fba9ccb5e7f945a06ce711b381da0819b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=76a43c5fba9ccb5e7f945a06ce711b381da0819b
Author: Brian Paul <bri...@vmware.com> Date: Thu Mar 10 08:50:52 2011 -0700 glx: fix null pointer deref in __glXGenerateError() The gc var would be NULL if called from line 238. Instead, get the opcode from __glXSetupForCommand(dpy) as done in other places. And remove the unused gc parameter. Fixes a bug reported by "John Doe" on 3/9/2011. NOTE: This is a candidate for the 7.10 branch. --- src/glx/glxcurrent.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index 9a64990..1f845ce 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -189,7 +189,7 @@ glXGetCurrentDrawable(void) } static void -__glXGenerateError(Display * dpy, struct glx_context *gc, XID resource, +__glXGenerateError(Display * dpy, XID resource, BYTE errorCode, CARD16 minorCode) { xError error; @@ -198,7 +198,7 @@ __glXGenerateError(Display * dpy, struct glx_context *gc, XID resource, error.resourceID = resource; error.sequenceNumber = dpy->request; error.type = X_Error; - error.majorCode = gc->majorOpcode; + error.majorCode = __glXSetupForCommand(dpy); error.minorCode = minorCode; _XError(dpy, &error); } @@ -235,12 +235,12 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, } if (gc == NULL && (draw != None || read != None)) { - __glXGenerateError(dpy, gc, (draw != None) ? draw : read, + __glXGenerateError(dpy, (draw != None) ? draw : read, BadMatch, X_GLXMakeContextCurrent); return False; } if (gc != NULL && (draw == None || read == None)) { - __glXGenerateError(dpy, gc, None, BadMatch, X_GLXMakeContextCurrent); + __glXGenerateError(dpy, None, BadMatch, X_GLXMakeContextCurrent); return False; } @@ -284,7 +284,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, __glXUnlock(); if (ret) { - __glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent); + __glXGenerateError(dpy, None, ret, X_GLXMakeContextCurrent); return GL_FALSE; } _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit