summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Jackson <[email protected]>2018-07-06 14:59:21 -0400
committerDylan Baker <[email protected]>2018-07-10 09:30:44 -0700
commit658d4e8e0096ececfb4e587969f1b65689d2c913 (patch)
tree5b4106784246a033c1e21084acd9a7f7e4ebbcfe
parente681c0eb9dfb4358d94c7930fdc3ed6dddd9eb9f (diff)
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: <[email protected]> Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]> (cherry picked from commit d257ec01360be05a745bbb851f08e944bcb23718)
-rw-r--r--src/glx/glxcurrent.c7
1 files changed, 7 insertions, 0 deletions
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);