diff options
author | Brian Paul <[email protected]> | 2011-03-10 08:50:52 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-03-10 08:50:52 -0700 |
commit | 76a43c5fba9ccb5e7f945a06ce711b381da0819b (patch) | |
tree | 984fc9c3319c58cbc1b687b5c1a59d56b60a3fcb | |
parent | 6d4e337f3890105c7d8a2f132412c137d2570d25 (diff) |
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.
-rw-r--r-- | 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 9a6499037b1..1f845ce65e1 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; } |