Title: [258200] trunk/Source/WebKit
Revision
258200
Author
[email protected]
Date
2020-03-10 05:49:58 -0700 (Tue, 10 Mar 2020)

Log Message

Do not process RTC Network messages coming from NetworkProcess if LibWebRTCNetwork is not active
https://bugs.webkit.org/show_bug.cgi?id=207376

Reviewed by Eric Carlson.

In case LibWebRTCNetwork is not active, we do not have instantiated any peer connection.
We do not have started any related RTC thread so we are not expecting any RTC message from Network Process.
Exit early in that case.

* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didReceiveMessage):
* WebProcess/Network/webrtc/LibWebRTCNetwork.h:
(WebKit::LibWebRTCNetwork::isActive const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (258199 => 258200)


--- trunk/Source/WebKit/ChangeLog	2020-03-10 12:33:23 UTC (rev 258199)
+++ trunk/Source/WebKit/ChangeLog	2020-03-10 12:49:58 UTC (rev 258200)
@@ -1,3 +1,19 @@
+2020-03-10  youenn fablet  <[email protected]>
+
+        Do not process RTC Network messages coming from NetworkProcess if LibWebRTCNetwork is not active
+        https://bugs.webkit.org/show_bug.cgi?id=207376
+
+        Reviewed by Eric Carlson.
+
+        In case LibWebRTCNetwork is not active, we do not have instantiated any peer connection.
+        We do not have started any related RTC thread so we are not expecting any RTC message from Network Process.
+        Exit early in that case.
+
+        * WebProcess/Network/NetworkProcessConnection.cpp:
+        (WebKit::NetworkProcessConnection::didReceiveMessage):
+        * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
+        (WebKit::LibWebRTCNetwork::isActive const):
+
 2020-03-10  Diego Pino Garcia  <[email protected]>
 
         REGRESSION(r258182): [GTK] Remove reference to unrequestedTextCheckingSequence

Modified: trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp (258199 => 258200)


--- trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp	2020-03-10 12:33:23 UTC (rev 258199)
+++ trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp	2020-03-10 12:49:58 UTC (rev 258200)
@@ -111,21 +111,37 @@
 
 #if USE(LIBWEBRTC)
     if (decoder.messageReceiverName() == Messages::WebRTCSocket::messageReceiverName()) {
-        WebProcess::singleton().libWebRTCNetwork().socket(makeObjectIdentifier<LibWebRTCSocketIdentifierType>(decoder.destinationID())).didReceiveMessage(connection, decoder);
+        auto& libWebRTCNetwork = WebProcess::singleton().libWebRTCNetwork();
+        if (libWebRTCNetwork.isActive())
+            libWebRTCNetwork.socket(makeObjectIdentifier<LibWebRTCSocketIdentifierType>(decoder.destinationID())).didReceiveMessage(connection, decoder);
+        else
+            RELEASE_LOG_ERROR(WebRTC, "Received WebRTCSocket message while libWebRTCNetwork is not active");
         return;
     }
     if (decoder.messageReceiverName() == Messages::WebRTCMonitor::messageReceiverName()) {
-        WebProcess::singleton().libWebRTCNetwork().monitor().didReceiveMessage(connection, decoder);
+        auto& libWebRTCNetwork = WebProcess::singleton().libWebRTCNetwork();
+        if (libWebRTCNetwork.isActive())
+            libWebRTCNetwork.monitor().didReceiveMessage(connection, decoder);
+        else
+            RELEASE_LOG_ERROR(WebRTC, "Received WebRTCMonitor message while libWebRTCNetwork is not active");
         return;
     }
     if (decoder.messageReceiverName() == Messages::WebRTCResolver::messageReceiverName()) {
-        WebProcess::singleton().libWebRTCNetwork().resolver(makeObjectIdentifier<LibWebRTCResolverIdentifierType>(decoder.destinationID())).didReceiveMessage(connection, decoder);
+        auto& libWebRTCNetwork = WebProcess::singleton().libWebRTCNetwork();
+        if (libWebRTCNetwork.isActive())
+            libWebRTCNetwork.resolver(makeObjectIdentifier<LibWebRTCResolverIdentifierType>(decoder.destinationID())).didReceiveMessage(connection, decoder);
+        else
+            RELEASE_LOG_ERROR(WebRTC, "Received WebRTCResolver message while libWebRTCNetwork is not active");
         return;
     }
 #endif
 #if ENABLE(WEB_RTC)
     if (decoder.messageReceiverName() == Messages::WebMDNSRegister::messageReceiverName()) {
-        WebProcess::singleton().libWebRTCNetwork().mdnsRegister().didReceiveMessage(connection, decoder);
+        auto& libWebRTCNetwork = WebProcess::singleton().libWebRTCNetwork();
+        if (libWebRTCNetwork.isActive())
+            libWebRTCNetwork.mdnsRegister().didReceiveMessage(connection, decoder);
+        else
+            RELEASE_LOG_ERROR(WebRTC, "Received WebMDNSRegister message while libWebRTCNetwork is not active");
         return;
     }
 #endif

Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h (258199 => 258200)


--- trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h	2020-03-10 12:33:23 UTC (rev 258199)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h	2020-03-10 12:49:58 UTC (rev 258200)
@@ -26,6 +26,7 @@
 #pragma once
 
 #if USE(LIBWEBRTC)
+#include "LibWebRTCProvider.h"
 #include "LibWebRTCSocketFactory.h"
 #include "WebRTCMonitor.h"
 #include "WebRTCResolver.h"
@@ -44,6 +45,8 @@
 
     void networkProcessCrashed();
 
+    bool isActive() const;
+
 #if USE(LIBWEBRTC)
     WebRTCMonitor& monitor() { return m_webNetworkMonitor; }
     LibWebRTCSocketFactory& socketFactory() { return m_socketFactory; }
@@ -75,4 +78,13 @@
 #endif
 }
 
+inline bool LibWebRTCNetwork::isActive() const
+{
+#if USE(LIBWEBRTC)
+    return WebCore::LibWebRTCProvider::hasWebRTCThreads();
+#else
+    return false;
+#endif
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to