File qglxconvenience-avoid-null-pointer-deref.patch of Package libqt5-qtbase.8869

From 37b279dda0387ad917da586c19c0605c0be10afc Mon Sep 17 00:00:00 2001
From: Kai Uwe Broulik <kde@privat.broulik.de>
Date: Tue, 12 Sep 2017 16:18:58 +0200
Subject: [PATCH] qglxconvenience: Avoid null pointer dereference
References: boo#1057971, kde#384540

glXGetVisualFromFBConfig according to documentation can return NULL [1].
This may result in a crash when running Qt applications using ARGB windows
with XLIB_SKIP_ARGB_VISUALS defined.

[1] https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXGetVisualFromFBConfig.xml

Change-Id: Ie076a1e906ed632543bdab03ef365f699533a61a
---
 src/platformsupport/glxconvenience/qglxconvenience.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp
index 8c26550..46bd579 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience.cpp
+++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp
@@ -151,6 +151,8 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format
                     glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
                     if (alphaSize > 0) {
                         XVisualInfo *visual = glXGetVisualFromFBConfig(display, chosenConfig);
+                        if (!visual)
+                            continue;
                         bool hasAlpha = false;
 
 #if !defined(QT_NO_XRENDER)
-- 
2.7.4
openSUSE Build Service is sponsored by