From e4375046e04111fb569ac1686233b40ba75849f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 14 Jul 2021 16:48:34 +0200 Subject: [PATCH] cogl/gl: Handle bogus glGetString(GL_RENDERER) return values Seems glGetString(GL_RENDERER) in the wild can return NULL, causing issues with strstr(). Handle this more gracefully by using g_return_val_if_fail(), that assumes a NULL renderer means software rendering. Part-of: --- cogl/cogl/driver/gl/cogl-util-gl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogl/cogl/driver/gl/cogl-util-gl.c b/cogl/cogl/driver/gl/cogl-util-gl.c index 096fcb788..80c417913 100644 --- a/cogl/cogl/driver/gl/cogl-util-gl.c +++ b/cogl/cogl/driver/gl/cogl-util-gl.c @@ -460,6 +460,13 @@ _cogl_driver_gl_is_hardware_accelerated (CoglContext *ctx) const char *renderer = (const char *) ctx->glGetString (GL_RENDERER); gboolean software; + if (!renderer) + { + g_warning ("OpenGL driver returned NULL as the renderer, " + "something is wrong"); + return TRUE; + } + software = strstr (renderer, "llvmpipe") != NULL || strstr (renderer, "softpipe") != NULL || strstr (renderer, "software rasterizer") != NULL ||