diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-04-05 18:02:47 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-08-17 19:19:17 +0100 |
commit | bfd1c05174b86c9dfcf1b22a4fa0b2c552dfc902 (patch) | |
tree | 6c8a6ab478378f2899b0faa8f9743f2d0b2f6b1a | |
parent | 30198a2368c9cd19db4b8f595bfad7a719ada7e9 (diff) | |
download | dbus-glib-bfd1c05174b86c9dfcf1b22a4fa0b2c552dfc902.tar.gz |
get_all_object_properties: note which operations can only fail via OOM
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
-rw-r--r-- | dbus/dbus-gobject.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index e4775b4..da3d7b0 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -1266,6 +1266,7 @@ get_all_object_properties (DBusConnection *connection, dbus_message_iter_init_append (ret, &iter_ret); + /* the types are all hard-coded, so this can only fail via OOM */ if (!dbus_message_iter_open_container (&iter_ret, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING @@ -1322,14 +1323,24 @@ get_all_object_properties (DBusConnection *connection, continue; } + /* a signature returned by _dbus_gvalue_to_signature had better be + * valid */ + g_assert (g_variant_is_signature (variant_sig)); + + /* type is hard-coded, so this can't fail except by OOM */ if (!dbus_message_iter_open_container (&iter_dict, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict_entry)) goto oom; + + /* prop_name is valid UTF-8, so this can't fail except by OOM; no point + * in abandoning @iter_dict_entry since we're about to crash out */ if (!dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING, &prop_name)) goto oom; + /* variant_sig has been asserted to be valid, so this can't fail + * except by OOM */ if (!dbus_message_iter_open_container (&iter_dict_entry, DBUS_TYPE_VARIANT, variant_sig, @@ -1339,6 +1350,7 @@ get_all_object_properties (DBusConnection *connection, if (!_dbus_gvalue_marshal (&iter_dict_value, &value)) goto oom; + /* these shouldn't fail except by OOM now that we were successful */ if (!dbus_message_iter_close_container (&iter_dict_entry, &iter_dict_value)) goto oom; |