[PATCH] GLX: Avoid a crash if we ever end up trying to use glapi_noop_table

Brian Paul brianp at vmware.com
Thu Jan 8 12:59:48 PST 2009


I'm in favor of this patch.  But I'm not such which xserver branch(es) 
it should be applied to.  Can someone clue me in?

-Brian

Jon TURNEY wrote:
> I'm not sure if this is patch-worthy or not, but whilst getting GLX to work 
> again on Cygwin/X I came across this...
> 
> If the GL dispatch table pointer points to glapi_noop_table, (due to some kind 
> of terrible failure during GL initialization), running glxinfo for e.g. will 
> crash the X server, as DoGetString(GL_VERSION) tries to do atof() on the null 
> pointer returned by the noop dispatch function.
> 
> Given that all that noop dispatch table stuff is in there, I guess it's 
> preferable that it doesn't crash in that case.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> From 2e9ddcdaa1890204ec69ba6848cb1c49d5b85ef3 Mon Sep 17 00:00:00 2001
> Message-Id: <2e9ddcdaa1890204ec69ba6848cb1c49d5b85ef3.1231288719.git.jon.turney at dronecode.org.uk>
> In-Reply-To: <cover.1231288706.git.jon.turney at dronecode.org.uk>
> References: <cover.1231288706.git.jon.turney at dronecode.org.uk>
> From: Jon TURNEY <jon.turney at dronecode.org.uk>
> Date: Mon, 5 Jan 2009 13:52:45 +0000
> Subject: [PATCH 18/22] GLX: Avoid a crash when we have an uninitialized GL context
> 
> If the GL dispatch table pointer points to glapi_noop_table,
> (due to some kind of GL initialization failure), DoGetString(GL_VERSION)
> (for example as invoked by glxinfo) will crash as it tries to
> do atof() on the null pointer returned by the noop dispatch function
> 
> Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
> ---
>  glx/single2.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/glx/single2.c b/glx/single2.c
> index 0ca808c..50a59ed 100644
> --- a/glx/single2.c
> +++ b/glx/single2.c
> @@ -335,6 +335,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
>      string = (const char *) CALL_GetString( GET_DISPATCH(), (name) );
>      client = cl->client;
>  
> +    if (string == NULL)
> +      string = "";
> +
>      /*
>      ** Restrict extensions to those that are supported by both the
>      ** implementation and the connection.  That is, return the
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg




More information about the xorg mailing list