[Mesa-stable] [PATCH] glx: Don't allow glXMakeContextCurrent() with only one valid drawable

Adam Jackson ajax at redhat.com
Fri Jul 6 18:59:21 UTC 2018


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

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/glx/glxcurrent.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index fd04929b89f..2b9c708c3ee 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -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);
-- 
2.17.0



More information about the mesa-stable mailing list