Skip to content
Permalink
Browse files
Make sure sockets file descriptors are in the correct range
https://bugs.webkit.org/show_bug.cgi?id=197301
<rdar://problem/48389381>

Reviewed by Chris Dumez.

* Source/webrtc/rtc_base/physicalsocketserver.cc:
* WebKit/0001-fix-197301.patch: Added.


Canonical link: https://commits.webkit.org/211512@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Apr 26, 2019
1 parent b657fb0 commit 6bcff87e9a1cdb10813343b9125117a91190de8e
Showing 3 changed files with 38 additions and 0 deletions.
@@ -1,3 +1,14 @@
2019-04-25 Youenn Fablet <youenn@apple.com>

Make sure sockets file descriptors are in the correct range
https://bugs.webkit.org/show_bug.cgi?id=197301
<rdar://problem/48389381>

Reviewed by Chris Dumez.

* Source/webrtc/rtc_base/physicalsocketserver.cc:
* WebKit/0001-fix-197301.patch: Added.

2019-04-25 Alex Christensen <achristensen@webkit.org>

Start using C++17
@@ -1424,6 +1424,8 @@ bool PhysicalSocketServer::WaitSelect(int cmsWait, bool process_io) {
// "select"ing a file descriptor that is equal to or larger than
// FD_SETSIZE will result in undefined behavior.
RTC_DCHECK_LT(fd, FD_SETSIZE);
if (fd < 0 || fd >= FD_SETSIZE)
continue;
if (fd > fdmax)
fdmax = fd;

@@ -0,0 +1,25 @@
From cc826ae8baabae99a147d57ee2216e4cc4c2eaf6 Mon Sep 17 00:00:00 2001
From: Youenn Fablet <youenn@apple.com>
Date: Thu, 25 Apr 2019 16:39:31 -0700
Subject: [PATCH] fix-197301

---
.../libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc
index 7448a7e0427..91cb7da8366 100644
--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc
+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/physicalsocketserver.cc
@@ -1424,6 +1424,8 @@ bool PhysicalSocketServer::WaitSelect(int cmsWait, bool process_io) {
// "select"ing a file descriptor that is equal to or larger than
// FD_SETSIZE will result in undefined behavior.
RTC_DCHECK_LT(fd, FD_SETSIZE);
+ if (fd < 0 || fd >= FD_SETSIZE)
+ continue;
if (fd > fdmax)
fdmax = fd;

--
2.20.1 (Apple Git-116)

0 comments on commit 6bcff87

Please sign in to comment.