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

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Feb 3 06:48:08 UTC 2017


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

On Thu, 2017-02-02 at 13:14 -0800, Kenneth Graunke wrote:
> 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;
>     }


More information about the mesa-dev mailing list