Skip to content

atk-adaptor: Limit amount of children to return for GetChildren

Similar to how

commit b2ead1ef73e3ab3773b00923b9f19f022ed6fe81
Author: Mike Gorse <mgorse@suse.com>
Date:   Mon Aug 7 13:36:58 2023 -0500

    collection: Avoid locking up if an object has a very large child count

did for the atk-adaptor implementation of the AT-SPI Collection interface, also limit the maximum amount of children to return when the "GetChildren" method of the Accessible interface gets called.

This e.g. prevents LibreOffice Calc from freezing when all children are queried this way on the spreadsheet object, as Calc reports 2^31 children.

Quoting from Luuk van der Duim's email to the LibreOffice development mailing list:

If GetChildren is called on that object, Calc freezes and the AT (eg. screen-reader) performing the call would wait for a response.

Each object-reference in atspi (Rust crate) [2] is 48 bytes. If all children were to be returned, this would be a D-Bus message of 96 GiB. This is impractical and cannot be performed legally either, because the maximum size of a D-Bus message is 128 MiB. [3]

The main problem however is that calc freezes and that screen-readers need to take measures to avoid calc from sending huge numbers of children.

(...)

[2]: https://github.com/odilia-app/atspi

[3]: https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages

Merge request reports