diff options
author | Lukáš Tyrychtr <ltyrycht@redhat.com> | 2023-05-10 10:52:06 +0200 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2023-05-10 12:39:30 -0500 |
commit | 46d63e63776ca28df5deb1725ab6daf7fead8359 (patch) | |
tree | 798069c9db349e12686ab803463c187e418f172f | |
parent | b6e4d1721c30600ddbb888262e97fe8e791ff4d5 (diff) | |
download | at-spi2-core-46d63e63776ca28df5deb1725ab6daf7fead8359.tar.gz |
Don't crash when an invalid index, for the array length, is requested
for the cached children array
Fixes #114.
-rw-r--r-- | atspi/atspi-accessible.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 65c1f354..6c538e5f 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -490,9 +490,12 @@ atspi_accessible_get_child_at_index (AtspiAccessible *obj, if (!obj->children) return NULL; /* assume disposed */ - child = g_ptr_array_index (obj->children, child_index); - if (child) - return g_object_ref (child); + if (child_index < obj->children->len) + { + child = g_ptr_array_index (obj->children, child_index); + if (child) + return g_object_ref (child); + } } reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, |