Review Request 112069: Call KPluginInfo::KPluginInfo with the resource argument

Hrvoje Senjan hrvoje.senjan at gmail.com
Wed Aug 14 10:56:33 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112069/
-----------------------------------------------------------

(Updated Aug. 14, 2013, 10:56 a.m.)


Status
------

This change has been discarded.


Review request for Plasma.


Description
-------

>From the bug report:

"I have analyzed the crashed application in gdb, and I believe this code in Plasma::ThemePrivate::useCache() is the real culprit:

230             if (isRegularTheme) {
231                 const QString path = KStandardDirs::locate("data", "desktoptheme/" + themeName + "/metadata.desktop");
232                 const KPluginInfo pluginInfo(path);

Note that "path" is a relative path and KPluginInfo::KPluginInfo is called with only one argument. However, KPluginInfo constructor is declared as:

         * @param filename  The filename of the .desktop file.
         * @param resource  If filename is relative, you need to specify a resource type
         * (e.g. "service", "apps"... KStandardDirs). Otherwise,
         * resource isn't used.
         */
        explicit KPluginInfo( const QString & filename, const char* resource = 0 );

So, if you call it without the "resource" argument, the default value is used, which is NULL. This is invalid for a relative path, and indeed causes the crash further down the stack in KStandardDirs::saveLocation():

1499            if (dirs.isEmpty() && (
1500                    (strcmp(type, "socket") == 0) ||
1501                    (strcmp(type, "tmp") == 0) ||
1502                    (strcmp(type, "cache") == 0) ))

Unsurprisingly, calling strcmp(NULL, something) will cause a SIGSEGV."


Note that it's not my patch, but i feel it's a waste it's just sitting there in the report, and not here ;-)
Issue is triggered very easily by explcitly definining a plasma theme which does not exist (with e.g. adding 
[Theme]
name=fake-non-existant-theme
in plasmarc)


This addresses bugs 320855 and 322446.
    http://bugs.kde.org/show_bug.cgi?id=320855
    http://bugs.kde.org/show_bug.cgi?id=322446


Diffs
-----

  plasma/theme.cpp 4554de7 

Diff: http://git.reviewboard.kde.org/r/112069/diff/


Testing
-------

Tried the above example with the patch, plasma doesn't crash


Thanks,

Hrvoje Senjan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130814/634adc35/attachment-0001.html>


More information about the Plasma-devel mailing list