Fix browser node lifetime and fail closed on unknown protection

Retire ATK nodes without accessing freed children or retaining dangling parent and ID pointers. Treat failed and malformed MSAA state queries as protected, and initialize worker logging before argument validation.

Add publisher lifetime and worker privacy regressions, correct the publisher build target dependency, and remove both browser artifacts during uninstall.

Validation: build, all 12 CTests, updated startup-error regression, AddressSanitizer lifetime check, shellcheck, and temporary-prefix removal check passed. Live speech and Braille acceptance remains separate.
This commit is contained in:
Storm Dragon committed 2026-12-02 23:22:12 -05:00
1 parent 9c1fc644ba
commit 6bdd04cce1
8 files changed
+150 -11

No files matched your search

+5 -2
View File
@@ -411,7 +411,9 @@ static WaNode *load_node(JsonObject *object, WaNode *parent) {
node->parent = parent;
WaNode *previous = node_for_id(node->id);
if (previous && !previous->defunct) g_warning("duplicate uniqueID %ld", node->id);
g_hash_table_insert(nodesById, &node->id, node);
// The key lives inside the node. Replacing just the value would retain
// the old node's key after that node is retired and freed.
g_hash_table_replace(nodesById, &node->id, node);
node->children = g_ptr_array_new();
JsonArray *children = json_object_get_array_member(object, "children");
@@ -1854,13 +1856,14 @@ static void defunct_subtree(WaNode *node) {
if (node->defunct) return;
if (traceMessages) g_printerr("trace: defunct %ld %s\n", node->id, atk_role_get_name(node->atkRole));
node->defunct = TRUE;
node->parent = NULL;
atk_object_set_parent(node->accessible, NULL);
if (node->id == focusedId) focusedId = 0;
if (node_for_id(node->id) == node) g_hash_table_remove(nodesById, &node->id);
atk_object_notify_state_change(node->accessible, ATK_STATE_DEFUNCT, TRUE);
for (guint i = 0; i < node->children->len; i++) {
WaNode *child = g_ptr_array_index(node->children, i);
defunct_subtree(child);
child->parent = NULL;
}
g_ptr_array_set_size(node->children, 0);
g_clear_object(&node->hyperlink);