diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-10-01 11:40:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-01 11:40:54 +0800 |
commit | 94e165096fd65e8237e60de570fb609604ab94c9 (patch) | |
tree | 93b0c632a3869b8cbaa109dc9bb46b7140d84817 /Lib/socket.py | |
parent | cf57cabef82c4689ce9796bb1fcdb125fa05efcb (diff) | |
download | cpython-git-94e165096fd65e8237e60de570fb609604ab94c9.tar.gz |
bpo-38319: Fix shutil._fastcopy_sendfile(): set sendfile() max block size (GH-16491)
Diffstat (limited to 'Lib/socket.py')
-rwxr-xr-x | Lib/socket.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index e5989d9dfd..84a5dcb0da 100755 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -356,8 +356,8 @@ class socket(_socket.socket): raise _GiveupOnSendfile(err) # not a regular file if not fsize: return 0 # empty file - blocksize = fsize if not count else count - + # Truncate to 1GiB to avoid OverflowError, see bpo-38319. + blocksize = min(count or fsize, 2 ** 30) timeout = self.gettimeout() if timeout == 0: raise ValueError("non-blocking sockets are not supported") |