[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
wilder-5.14
Kai Uwe Broulik 9 years ago
parent e43b89e2b9
commit 03374b185f
  1. 4
      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;

Loading…
Cancel
Save