Mesa (master): mesa: Don' t crash when destroying contexts created with no visual.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Feb 3 16:56:58 UTC 2017


Module: Mesa
Branch: master
Commit: 3f064e9a4076eac01cf7a59d0f30300ef0638aae
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f064e9a4076eac01cf7a59d0f30300ef0638aae

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Feb  2 10:10:30 2017 -0800

mesa: Don't crash when destroying contexts created with no visual.

dEQP-EGL.functional.create_context.no_config tries to create a context
with no config, then immediately destroys it.  The drawbuffer is never
set up, so we can't dereference it asking if it's double buffered, or
we'll crash on a null pointer dereference.

Just bail early.

Applications using EGL_KHR_no_config_context could hit this.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Chad Versace <chadversary at chromium.org>

---

 src/mesa/main/context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7ecd241..7676348 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1550,7 +1550,7 @@ _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
 static void
 handle_first_current(struct gl_context *ctx)
 {
-   if (ctx->Version == 0) {
+   if (ctx->Version == 0 || !ctx->DrawBuffer) {
       /* probably in the process of tearing down the context */
       return;
    }




More information about the mesa-commit mailing list