Bug 366575

Summary: kscreen_backend_launcher segfault when debugging is enabled
Product: [Plasma] KScreen Reporter: Georg <georgmueller>
Component: libkscreenAssignee: Sebastian Kügler <sebas>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.7.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Georg 2016-08-10 07:50:08 UTC
I tried to debug a kscreen issue and when enabling debugging via ~/.config/QtProject/qtlogging.ini, kscreen_backend_launcher crashed due to a null pointer dereference.

Reproducible: Always

Steps to Reproduce:
1. set the following content in ~/.config/QtProject/qtlogging.ini
[rules]
*.debug=false
kscreen.xrandr.debug=true
2. run a kscreen command to enable a secondary screen
In my case, this was: kscreen-doctor output.320.enable
3. segmentation fault

Actual Results:  
The problem lies in the following line:
https://github.com/KDE/libkscreen/blob/v5.7.3/backends/xrandr/xrandrconfig.cpp#L521

kscreenOutput->currentMode() is null, thus kscreenOutput->currentMode()->size() causes the segmentation fault.
Comment 1 Sebastian Kügler 2016-08-10 11:04:21 UTC
Proposed fix: https://phabricator.kde.org/D2330
Comment 2 Sebastian Kügler 2016-08-10 11:56:17 UTC
Patch is in master now. I'll see if I can backport it to 5.7.4, but it should get a few days of testing, first.

Thanks for the report!