From 7024d7328cc7f512b50b09ed5138485ea8b397e2 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 28 Jul 2014 17:32:16 +0100 Subject: [PATCH 1/2] _dbus_gtype_from_signature_iter: fail gracefully with unknown message types _dbus_gtype_from_signature_iter now returns G_TYPE_INVALID on unknown message types such as DBUS_TYPE_UNIX_FD or DBUS_TYPE_MAYBE. Symptoms: > arguments to dbus_signature_iter_recurse() were incorrect, assertion > "dbus_type_is_container (dbus_signature_iter_get_current_type (iter))" failed > in file ../../dbus/dbus-signature.c line 213. > This is normally a bug in some application using the D-Bus library. https://bugs.freedesktop.org/show_bug.cgi?id=80557 --- dbus/dbus-gsignature.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-gsignature.c b/dbus/dbus-gsignature.c index 46c9205..ed0880e 100644 --- a/dbus/dbus-gsignature.c +++ b/dbus/dbus-gsignature.c @@ -142,14 +142,16 @@ _dbus_gtype_from_signature_iter (DBusSignatureIter *iter, gboolean is_client) int current_type; current_type = dbus_signature_iter_get_current_type (iter); - /* TODO: handle type 0? */ + if (dbus_typecode_maps_to_basic (current_type)) return _dbus_gtype_from_basic_typecode (current_type); else if (current_type == DBUS_TYPE_OBJECT_PATH) return DBUS_TYPE_G_OBJECT_PATH; else if (current_type == DBUS_TYPE_SIGNATURE) return DBUS_TYPE_G_SIGNATURE; - else + else if (current_type == DBUS_TYPE_VARIANT || + current_type == DBUS_TYPE_ARRAY || + current_type == DBUS_TYPE_STRUCT) { DBusSignatureIter subiter; @@ -178,6 +180,11 @@ _dbus_gtype_from_signature_iter (DBusSignatureIter *iter, gboolean is_client) return G_TYPE_INVALID; } } + else + { + /* dbus-glib does not handle DBUS_TYPE_UNIX_FD or DBUS_TYPE_MAYBE */ + return G_TYPE_INVALID; + } } GType -- 1.8.5.3