diff options
author | Lukáš Tyrychtr <ltyrycht@redhat.com> | 2023-05-10 10:52:06 +0200 |
---|---|---|
committer | Lukáš Tyrychtr <ltyrycht@redhat.com> | 2023-05-10 11:29:51 +0200 |
commit | 6c6bf04b5ec1fe88e7db8e7c9047a6fba78bf6ef (patch) | |
tree | 56f2d493545c0a1c6c0dae71b9ebd95785b8bbce | |
parent | 77bfacc29cfc56ff868010826e3b714b3980c4c4 (diff) | |
download | at-spi2-core-6c6bf04b5ec1fe88e7db8e7c9047a6fba78bf6ef.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 54f67c8f..1ce6b707 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, |