From 3f064e9a4076eac01cf7a59d0f30300ef0638aae Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 2 Feb 2017 10:10:30 -0800 Subject: [PATCH] mesa: Don't crash when destroying contexts created with no visual. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Chad Versace --- 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; } -- 2.7.4