From 4ffbc984eac8a15925094614021de30dc8084e65 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 4 Jul 2012 15:21:05 -0700 Subject: [PATCH] glx: Reject creations of indirect contexts with unsupportable versions. Signed-off-by: Ian Romanick Reviewed-by: Dave Airlie Signed-off-by: Keith Packard --- glx/createcontext.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/glx/createcontext.c b/glx/createcontext.c index 2ba0e18c6..205a91959 100644 --- a/glx/createcontext.c +++ b/glx/createcontext.c @@ -259,6 +259,23 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) return __glXError(GLXBadProfileARB); } + /* There is no GLX protocol for desktop OpenGL versions after 1.4. There + * is no GLX protocol for any version of OpenGL ES. If the application is + * requested an indirect rendering context for a version that cannot be + * satisfied, reject it. + * + * The GLX_ARB_create_context spec says: + * + * "* If does not support compatible OpenGL contexts + * providing the requested API major and minor version, + * forward-compatible flag, and debug context flag, GLXBadFBConfig + * is generated." + */ + if (!req->isDirect && (major_version > 1 || minor_version > 4 + || profile == GLX_CONTEXT_ES2_PROFILE_BIT_EXT)) { + return __glXError(GLXBadFBConfig); + } + /* Allocate memory for the new context */ if (req->isDirect) {