summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2017-01-04 13:17:05 (GMT)
committerKai Uwe Broulik <kde@privat.broulik.de>2017-01-04 13:17:05 (GMT)
commit03374b185f9bd3bc4f70726ae641014a33278fdd (patch)
treed240c6ef456a4250860d1e05bf6ebefd56a3a096
parente43b89e2b9f3ff9bf6299488e82a365cbfde2b2a (diff)
[MPRIS Data Engine] Don't crash if "Metadata" is a map but of wrong type
QDBusArgument MapType fits all kinds of maps but when we try to stream a map of type other than a{sv} (which the MRPIS spec requires) into a QVariantMap we would crash. Explicitly check signature to avoid this. BUG: 374531 FIXED-IN: 5.8.6
-rw-r--r--dataengines/mpris2/playercontainer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/dataengines/mpris2/playercontainer.cpp b/dataengines/mpris2/playercontainer.cpp
index fc1b6e3..09197ac 100644
--- a/dataengines/mpris2/playercontainer.cpp
+++ b/dataengines/mpris2/playercontainer.cpp
@@ -180,7 +180,9 @@ void PlayerContainer::copyProperty(const QString& propName, const QVariant& _val
if (value.userType() == qMetaTypeId<QDBusArgument>()) {
if (expType == QVariant::Map) {
QDBusArgument arg = value.value<QDBusArgument>();
- if (arg.currentType() != QDBusArgument::MapType) {
+ // Bug 374531: MapType fits all kinds of maps but we crash when we try to stream the arg into a
+ // QVariantMap below but get a wrong signature, e.g. a{ss} instead of the expected a{sv}
+ if (arg.currentType() != QDBusArgument::MapType || arg.currentSignature() != QLatin1String("a{sv}")) {
qCWarning(MPRIS2) << m_dbusAddress << "exports" << propName
<< "with the wrong type; it should be D-Bus type \"a{sv}\"";
return;