From 6c6bf04b5ec1fe88e7db8e7c9047a6fba78bf6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tyrychtr?= Date: Wed, 10 May 2023 10:52:06 +0200 Subject: Don't crash when an invalid index, for the array length, is requested for the cached children array Fixes #114. --- atspi/atspi-accessible.c | 9 ++++++--- 1 file 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, -- cgit v1.2.1