[Mesa-dev] [PATCH] mesa: Don't crash when destroying contexts created with no visual.

Kenneth Graunke kenneth at whitecape.org
Thu Feb 2 21:14:45 UTC 2017


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.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.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 7ecd241e6eb..76763489b9f 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.11.0



More information about the mesa-dev mailing list