[PATCH 18/22] GLX: Avoid a crash when we have an uninitialized GL context

Jon TURNEY jon.turney at dronecode.org.uk
Mon Jan 5 05:52:45 PST 2009


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
-- 
1.6.0.4


--------------000505080506010104020701--


More information about the xorg mailing list