guard access to unsafe config pointer

Authored by sebas on May 4 2016, 12:49 AM.

Description

guard access to unsafe config pointer

Summary:
This fixes a crashing race condition in the kscreen kded module when
the config cannot be deserialized from the filesystem. In this case,
Serializer returns a nullptr which is then derefenced without
validation.

In practice, we just can't be sure the file can be read, so we need to
make sure that we're not passing configs around which may be empty.

Down the road, I think we should be a bit more careful also in
libkscreen, there's some API that can receive ConfigPtrs, which aren't
validated before dereferencing.

BUG:362586
FIXED-IN:5.6.4
CHANGELOG:Fix crasher in kscreen kded daemon

Test Plan:
Can't really test this scenario, since I can't reproduce the crash. All
testing I've done passes, and I've added a bunch of autotests for invalid
configs (separate commit)

Reviewers: Plasma, graesslin

Reviewed By: Plasma, graesslin

Subscribers: graesslin, plasma-devel

Projects: Plasma

Differential Revision: https://phabricator.kde.org/D1533

Details

Committed
sebasMay 6 2016, 12:03 PM
Reviewer
Plasma
Differential Revision
D1533: guard access to unsafe config pointer
Parents
R104:47a001d9217c: Fix the building of tests in parallel
Branches
Unknown
Tags
Unknown