diff options
author | Mike Gorse <mgorse@suse.com> | 2023-05-05 16:39:14 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2023-05-05 16:39:14 -0500 |
commit | ea0c9b49ee0901fc82aef8fa24d7521700c9bb3b (patch) | |
tree | 35df700fba191a355f5df029836438f6b50ca1d1 | |
parent | 6e4b76546950d53d1db61ce562952b812fe731e9 (diff) | |
download | at-spi2-core-ea0c9b49ee0901fc82aef8fa24d7521700c9bb3b.tar.gz |
When parsing GetItems, guard against adding an object as its own child
This can happen if a buggy application returns an accessible with itself as
its parent. This can cause problems later if something recurses through
an object's descendants (atspi_accessible_clear_cache for instance).
Helps #113
-rw-r--r-- | atspi/atspi-misc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c index 11f37da2..fa6929b3 100644 --- a/atspi/atspi-misc.c +++ b/atspi/atspi-misc.c @@ -596,7 +596,14 @@ add_accessible_from_iter (DBusMessageIter *iter) parent = _atspi_dbus_consume_accessible (&iter_struct); if (accessible->accessible_parent) g_object_unref (accessible->accessible_parent); - accessible->accessible_parent = parent; + if (parent == accessible) + { + guint pid = atspi_accessible_get_process_id (accessible, NULL); + g_warning ("Process %d sent an accessible with itself as its parent. This shouldn't happen.", pid); + accessible->accessible_parent = NULL; + } + else + accessible->accessible_parent = parent; if (dbus_message_iter_get_arg_type (&iter_struct) == 'i') { |