Upstream commit: https://webrtc.googlesource.com/src/+/097ff1111b1b94ad758ffbda21ec26c442717b45 Refactor waiting for timeout in PhysicalSocketServer - Move timeout related logic into dedicated helper class, thus unifying that logic across multiple call sites. - Switch function to query current time from TimeMicros to SystemTime to stress this class doesn't support injected clock. - Use TimeDelta type instead of plain int to pass around timeout. - Delete unused function GetSocketRecvTimestamp Bug: webrtc:42223992 Change-Id: I1f483985c8764539f20c51846d35daa62f90b108 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/465702 Reviewed-by: Evan Shrubsole <eshr@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47518}
30 lines
1.3 KiB
Diff
30 lines
1.3 KiB
Diff
From: Jed Davis <jld@mozilla.com>
|
|
Date: Sun, 17 Nov 2019 03:40:00 +0000
|
|
Subject: Bug 1545504 - Strengthen bounds check in WebRTC PhysicalSocketServer.
|
|
r=jesup
|
|
|
|
PhysicalSocketServer isn't currently used by Mozilla's WebRTC
|
|
integration, but just in case, let's make sure that this array index is
|
|
bounds-checked in actual use, not just in debug builds (which tend to
|
|
never see realistic test conditions).
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D52745
|
|
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2b079067648bfe0d064a334bf19bdcc233e26b6e
|
|
---
|
|
rtc_base/physical_socket_server.cc | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
|
|
index 2f4e7fe55c..55570dac38 100644
|
|
--- a/rtc_base/physical_socket_server.cc
|
|
+++ b/rtc_base/physical_socket_server.cc
|
|
@@ -1585,7 +1585,7 @@ bool PhysicalSocketServer::WaitSelect(TimeDelta timeout, bool process_io) {
|
|
int fd = pdispatcher->GetDescriptor();
|
|
// "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);
|
|
+ RTC_CHECK_LT(fd, FD_SETSIZE);
|
|
if (fd > fdmax)
|
|
fdmax = fd;
|
|
|