Skip to content

Commit

Permalink
Prevent huge child counts from stalling the example
Browse files Browse the repository at this point in the history
We know some applications may expose huge child counts, which will
stall the program.

This imposes an upper limit of 2^16 chilren.
If an object says to have more children, the example will skip it.
  • Loading branch information
luukvanderduim committed Jun 17, 2024
1 parent 29c37f9 commit 9a1e134
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions atspi/examples/bus-tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ impl A11yNode {

// If the stack has an `AccessibleProxy`, we take the last.
while let Some(ap) = stack.pop() {
// Prevent obects with huge child counts from stalling the program.
if ap.child_count().await? > 65536 {
continue;
}

let child_objects = ap.get_children().await?;
let mut children_proxies = try_join_all(
child_objects
Expand Down

0 comments on commit 9a1e134

Please sign in to comment.