From 9e4a858285af360dce4956141c71e94efbcb96a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 16 Nov 2016 08:36:51 +0100 Subject: [PATCH] Fix DebugConsole::initGLTab The initGLTab used GLPlatform::instance to determine whether OpenGL is used. It assumed a nullptr would mean no GL. But GLPlatform is a singleton which does not follow KWin's internal semantics. If there is no instance it will be created. Thus it's never null. This caused a heap-buffer-overflow as recorded by build.kde.org in case one just casts the scene pointer to SceneOpenGL. With this change this is fixed and inited correctly by verifying through the EffectsHandler whether opengl is used. --- debug_console.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debug_console.cpp b/debug_console.cpp index 48e152919e..f57d3f0c7f 100644 --- a/debug_console.cpp +++ b/debug_console.cpp @@ -516,12 +516,12 @@ DebugConsole::~DebugConsole() = default; void DebugConsole::initGLTab() { - GLPlatform *gl = GLPlatform::instance(); - if (!gl) { + if (!effects || !effects->isOpenGLCompositing()) { m_ui->noOpenGLLabel->setVisible(true); m_ui->glInfoScrollArea->setVisible(false); return; } + GLPlatform *gl = GLPlatform::instance(); m_ui->noOpenGLLabel->setVisible(false); m_ui->glInfoScrollArea->setVisible(true); m_ui->glVendorStringLabel->setText(QString::fromLocal8Bit(gl->glVendorString()));