libqt5-qtbase/qglxconvenience-avoid-null-pointer-deref.patch

34 lines
1.4 KiB
Diff

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
@@ -202,6 +202,8 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format
GLXFBConfig candidate = configs[i];
QXlibPointer<XVisualInfo> visual(glXGetVisualFromFBConfig(display, candidate));
+ if (!visual)
+ continue;
const int actualRed = qPopulationCount(visual->red_mask);
const int actualGreen = qPopulationCount(visual->green_mask);
--
2.7.4