Bug#974597: kiten: Segfaults on startup if KConfigGui::sessionConfig() returns nullptr
Package: kiten
Version: 4:20.04.3-1
Severity: important
Tags: patch
kiten invariably segfaults on startup for me:
#0 0x00007f3833a898ff in KConfigBase::hasGroup (this=0x0,
group=group@entry=0x561e19ce44a3 "app") at ./src/core/kconfigbase.cpp:22
#1 0x0000561e19cd660a in Kiten::finishInit (this=0x561e1b286560)
at ./app/kiten.cpp:297
This is due to KConfigGui::sessionConfig() no longer creating a session
config when the application is not actually being restored from an
earlier session, and returning nullptr instead. Hence the segfault.
Patch attached.
-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (100, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.7.0-2-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages kiten depends on:
ii edict 2020.07.01-1
ii fonts-ipafont-gothic [fonts-japanese-gothic] 00303-21
ii fonts-kanjistrokeorders 4.003~dfsg-1
ii kanjidic 2020.06.29-1
ii kio 5.74.0-2
ii libc6 2.31-4
ii libkf5archive5 5.74.0-2
ii libkf5completion5 5.74.0-2
ii libkf5configcore5 5.74.0-2
ii libkf5configgui5 5.74.0-2
ii libkf5configwidgets5 5.74.0-2
ii libkf5coreaddons5 5.74.0-2
ii libkf5crash5 5.74.0-2
ii libkf5i18n5 5.74.0-3
ii libkf5kiocore5 5.74.0-2
ii libkf5notifications5 5.74.0-2
ii libkf5widgetsaddons5 5.74.0-3
ii libkf5xmlgui5 5.74.0-2+b1
ii libqt5core5a 5.15.1+dfsg-2
ii libqt5dbus5 5.15.1+dfsg-2
ii libqt5gui5 5.15.1+dfsg-2
ii libqt5widgets5 5.15.1+dfsg-2
ii libstdc++6 10.2.0-16
kiten recommends no packages.
Versions of packages kiten suggests:
pn khelpcenter <none>
-- no debconf information
From 7b97ea2ba1eca291d313b92421c76eb07d0c9251 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbriere@fbriere.net>
Date: Tue, 10 Nov 2020 08:17:12 -0500
Subject: [PATCH] Check the return value of KConfigGui::sessionConfig() for
nullptr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
KConfigGui::sessionConfig() no longer creates a session config when the
application is not actually being restored from an earlier session.¹ In
this case, it will now return a null pointer, so we need to check for
that to avoid a segfault.
¹ See commit KDE/kconfig@23d4f14601fd8ff5ca7f28b0ad245ec1935799b2
---
app/kiten.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/kiten.cpp b/app/kiten.cpp
index b6f577a..1ff9d0d 100644
--- a/app/kiten.cpp
+++ b/app/kiten.cpp
@@ -294,7 +294,8 @@ void Kiten::finishInit()
// the app group won't exist and we show demo
if ( _config->initialSearch() )
{
- if ( ! KConfigGui::sessionConfig()->hasGroup( "app" ) )
+ KConfig *config = KConfigGui::sessionConfig();
+ if ( config && ! config->hasGroup( "app" ) )
{
searchTextAndRaise( QStringLiteral( "辞書" ) );
//Note to future tinkerers... DO NOT EDIT OR TRANSLATE THAT
--
2.28.0
Reply to: