glx: Don't allow glXMakeContextCurrent() with only one valid drawable

Drawable and readable need to either both be None or both be non-None.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Adam Jackson 2018-07-06 14:59:21 -04:00
parent af6b7bf236
commit d257ec0136

View file

@ -194,6 +194,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
return True;
}
/* can't have only one be 0 */
if (!!draw != !!read) {
__glXUnlock();
__glXSendError(dpy, BadMatch, None, X_GLXMakeContextCurrent, True);
return False;
}
if (oldGC != &dummyContext) {
if (--oldGC->thread_refcount == 0) {
oldGC->vtable->unbind(oldGC, gc);