Title: [246797] trunk/Source
Revision
246797
Author
[email protected]
Date
2019-06-25 11:09:32 -0700 (Tue, 25 Jun 2019)

Log Message

Close sockets with too high file descriptor
https://bugs.webkit.org/show_bug.cgi?id=199116

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

* Source/webrtc/rtc_base/physicalsocketserver.cc:
* WebKit/0001-Close-sockets-with-file-descriptors-above-FD_SETSIZE.patch: Added.

Source/WebKit:

Log the case of failing to open a socket.

* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createSocket):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (246796 => 246797)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2019-06-25 18:01:49 UTC (rev 246796)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2019-06-25 18:09:32 UTC (rev 246797)
@@ -1,3 +1,13 @@
+2019-06-25  Youenn Fablet  <[email protected]>
+
+        Close sockets with too high file descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=199116
+
+        Reviewed by Eric Carlson.
+
+        * Source/webrtc/rtc_base/physicalsocketserver.cc:
+        * WebKit/0001-Close-sockets-with-file-descriptors-above-FD_SETSIZE.patch: Added.
+
 2019-06-21  Youenn Fablet  <[email protected]>
 
         Make sure to check for file descriptor value before using FD_CLR

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc (246796 => 246797)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc	2019-06-25 18:01:49 UTC (rev 246796)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc	2019-06-25 18:09:32 UTC (rev 246797)
@@ -589,6 +589,10 @@
 
 bool SocketDispatcher::Initialize() {
   RTC_DCHECK(s_ != INVALID_SOCKET);
+#if defined(WEBRTC_WEBKIT_BUILD)
+  if (s_ < 0 || s_ >= FD_SETSIZE)
+    return false;
+#endif
 // Must be a non-blocking
 #if defined(WEBRTC_WIN)
   u_long argp = 1;

Added: trunk/Source/ThirdParty/libwebrtc/WebKit/0001-Close-sockets-with-file-descriptors-above-FD_SETSIZE.patch (0 => 246797)


--- trunk/Source/ThirdParty/libwebrtc/WebKit/0001-Close-sockets-with-file-descriptors-above-FD_SETSIZE.patch	                        (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/WebKit/0001-Close-sockets-with-file-descriptors-above-FD_SETSIZE.patch	2019-06-25 18:09:32 UTC (rev 246797)
@@ -0,0 +1,27 @@
+From 9dfcb7989c54b62a8499721e942b5221430839a0 Mon Sep 17 00:00:00 2001
+From: Youenn Fablet <[email protected]>
+Date: Fri, 21 Jun 2019 13:26:51 -0700
+Subject: [PATCH] Close sockets with file descriptors above FD_SETSIZE
+
+---
+ .../libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc  | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc
+index 91cb7da8366..ea67624192b 100644
+--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc
++++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc
+@@ -589,6 +589,10 @@ SocketDispatcher::~SocketDispatcher() {
+ 
+ bool SocketDispatcher::Initialize() {
+   RTC_DCHECK(s_ != INVALID_SOCKET);
++#if defined(WEBRTC_WEBKIT_BUILD)
++  if (s_ < 0 || s_ >= FD_SETSIZE)
++    return false;
++#endif
+ // Must be a non-blocking
+ #if defined(WEBRTC_WIN)
+   u_long argp = 1;
+-- 
+2.21.0 (Apple Git-118)
+

Modified: trunk/Source/WebKit/ChangeLog (246796 => 246797)


--- trunk/Source/WebKit/ChangeLog	2019-06-25 18:01:49 UTC (rev 246796)
+++ trunk/Source/WebKit/ChangeLog	2019-06-25 18:09:32 UTC (rev 246797)
@@ -1,3 +1,15 @@
+2019-06-25  Youenn Fablet  <[email protected]>
+
+        Close sockets with too high file descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=199116
+
+        Reviewed by Eric Carlson.
+
+        Log the case of failing to open a socket.
+
+        * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+        (WebKit::NetworkRTCProvider::createSocket):
+
 2019-06-25  Tim Horton  <[email protected]>
 
         When Caps Lock is enabled on the Smart Keyboard, can't scroll with space or arrow keys

Modified: trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp (246796 => 246797)


--- trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp	2019-06-25 18:01:49 UTC (rev 246796)
+++ trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp	2019-06-25 18:09:32 UTC (rev 246797)
@@ -98,7 +98,8 @@
 void NetworkRTCProvider::createSocket(uint64_t identifier, std::unique_ptr<rtc::AsyncPacketSocket>&& socket, LibWebRTCSocketClient::Type type)
 {
     if (!socket) {
-        sendFromMainThread([identifier](IPC::Connection& connection) {
+        sendFromMainThread([identifier, size = m_sockets.size()](IPC::Connection& connection) {
+            RELEASE_LOG_ERROR(WebRTC, "NetworkRTCProvider with %u sockets is unable to create a new socket", size);
             connection.send(Messages::WebRTCSocket::SignalClose(1), identifier);
         });
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to