From 94e165096fd65e8237e60de570fb609604ab94c9 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Tue, 1 Oct 2019 11:40:54 +0800 Subject: bpo-38319: Fix shutil._fastcopy_sendfile(): set sendfile() max block size (GH-16491) --- Lib/socket.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/socket.py') 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") -- cgit v1.2.1