commit | a0b914dcebb6bf420b2d73dd3977051b3fac20d2 | [log] [tgz] |
---|---|---|
author | Peter Kasting <[email protected]> | Thu Jul 14 18:43:19 2022 |
committer | Chromium LUCI CQ <[email protected]> | Thu Jul 14 18:43:19 2022 |
tree | 3313b0102475e2d6c9b10a53f439969b266fe68d | |
parent | 6f80b38c9ef19fea5595b3e3e47b49751b0bcbbb [diff] [blame] |
Reland "Prevent unsafe narrowing: base/ for Linux part 2 of n" Bug: 1292951 Change-Id: I2ba0e069a26ebac13dcd4ae162764d28d90f4a73 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758876 Reviewed-by: danakj <[email protected]> Owners-Override: danakj <[email protected]> Commit-Queue: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/main@{#1024348}
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc index 92d47fc..1b75de7 100644 --- a/base/sync_socket_posix.cc +++ b/base/sync_socket_posix.cc
@@ -23,6 +23,7 @@ #include "base/check_op.h" #include "base/containers/span.h" #include "base/files/file_util.h" +#include "base/numerics/safe_conversions.h" #include "base/threading/scoped_blocking_call.h" #include "build/build_config.h" @@ -174,8 +175,7 @@ // If there is an error in ioctl, signal that the channel would block. return 0; } - DCHECK_GE(number_chars, 0); - return number_chars; + return checked_cast<size_t>(number_chars); } bool SyncSocket::IsValid() const {