Title: [289804] trunk/Source
Revision
289804
Author
[email protected]
Date
2022-02-15 06:07:45 -0800 (Tue, 15 Feb 2022)

Log Message

[GTK] D-Bus crash atk-bridge
https://bugs.webkit.org/show_bug.cgi?id=236208

Reviewed by Adrian Perez de Castro.

Source/WebCore:

When a root is unregistered, check first if the registration is still pending to just complete and remove it.

* accessibility/atspi/AccessibilityAtspi.cpp:
(WebCore::AccessibilityAtspi::unregisterRoot):

Source/WebKit:

It seems that for some reason we might end up with an empty string as plug ID which ATK doesn't handle right. We
should not send the BindAccessibilityTree message if the plug ID is not valid. In the case of ATSPI we can just
check it's not empty, since we know we always build a valid ID when we have a connection. In the case of ATK we
should check it's a valid unique name and object path.

* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289803 => 289804)


--- trunk/Source/WebCore/ChangeLog	2022-02-15 14:06:59 UTC (rev 289803)
+++ trunk/Source/WebCore/ChangeLog	2022-02-15 14:07:45 UTC (rev 289804)
@@ -1,3 +1,15 @@
+2022-02-15  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] D-Bus crash atk-bridge
+        https://bugs.webkit.org/show_bug.cgi?id=236208
+
+        Reviewed by Adrian Perez de Castro.
+
+        When a root is unregistered, check first if the registration is still pending to just complete and remove it.
+
+        * accessibility/atspi/AccessibilityAtspi.cpp:
+        (WebCore::AccessibilityAtspi::unregisterRoot):
+
 2022-02-15  Enrique Ocaña González  <[email protected]>
 
         [GStreamer][MSE] Let MSE set natural video size when using holepunch

Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp (289803 => 289804)


--- trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp	2022-02-15 14:06:59 UTC (rev 289803)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp	2022-02-15 14:07:45 UTC (rev 289804)
@@ -303,6 +303,15 @@
 
 void AccessibilityAtspi::unregisterRoot(AccessibilityRootAtspi& rootObject)
 {
+    for (unsigned i = 0; i < m_pendingRootRegistrations.size(); ++i) {
+        auto& pendingRootRegistration = m_pendingRootRegistrations[i];
+        if (pendingRootRegistration.root.ptr() == &rootObject) {
+            pendingRootRegistration.completionHandler({ });
+            m_pendingRootRegistrations.remove(i);
+            return;
+        }
+    }
+
     if (!m_connection)
         return;
 

Modified: trunk/Source/WebKit/ChangeLog (289803 => 289804)


--- trunk/Source/WebKit/ChangeLog	2022-02-15 14:06:59 UTC (rev 289803)
+++ trunk/Source/WebKit/ChangeLog	2022-02-15 14:07:45 UTC (rev 289804)
@@ -1,3 +1,18 @@
+2022-02-15  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] D-Bus crash atk-bridge
+        https://bugs.webkit.org/show_bug.cgi?id=236208
+
+        Reviewed by Adrian Perez de Castro.
+
+        It seems that for some reason we might end up with an empty string as plug ID which ATK doesn't handle right. We
+        should not send the BindAccessibilityTree message if the plug ID is not valid. In the case of ATSPI we can just
+        check it's not empty, since we know we always build a valid ID when we have a connection. In the case of ATK we
+        should check it's a valid unique name and object path.
+
+        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+        (WebKit::WebPage::platformInitialize):
+
 2022-02-15  Kimmo Kinnunen  <[email protected]>
 
         Memory for messages wrapped for testing is freed before use

Modified: trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (289803 => 289804)


--- trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp	2022-02-15 14:06:59 UTC (rev 289803)
+++ trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp	2022-02-15 14:07:45 UTC (rev 289804)
@@ -64,9 +64,28 @@
     // process to connect the two worlds through the accessibility
     // object there specifically placed for that purpose (the socket).
 #if USE(ATK)
+    auto isValidPlugID = [](const char* plugID) -> bool {
+        if (!plugID || plugID[0] != ':')
+            return false;
+
+        auto* p = g_strrstr(plugID, ":");
+        if (!p)
+            return false;
+
+        if (!g_variant_is_object_path(p + 1))
+            return false;
+
+        GUniquePtr<char> name(g_strndup(plugID, p - plugID));
+        if (!g_dbus_is_unique_name(name.get()))
+            return false;
+
+        return true;
+    };
+
     m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this));
     GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get())));
-    send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
+    if (isValidPlugID(plugID.get()))
+        send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
 #elif USE(ATSPI)
 #if USE(GTK4)
     // FIXME: we need a way to connect DOM and app a11y tree in GTK4.
@@ -74,7 +93,8 @@
     if (auto* page = corePage()) {
         m_accessibilityRootObject = AccessibilityRootAtspi::create(*page);
         m_accessibilityRootObject->registerObject([&](const String& plugID) {
-            send(Messages::WebPageProxy::BindAccessibilityTree(plugID));
+            if (!plugID.isEmpty())
+                send(Messages::WebPageProxy::BindAccessibilityTree(plugID));
         });
     }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to