Skip to content

Commit

Permalink
gh-114077: Fix OverflowError in socket.sendfile() when pass count >2G…
Browse files Browse the repository at this point in the history
…iB (GH-114079)
  • Loading branch information
serhiy-storchaka authored Jan 16, 2024
1 parent c85c002 commit d4dfad2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def _sendfile_use_sendfile(self, file, offset=0, count=None):
if timeout and not selector_select(timeout):
raise TimeoutError('timed out')
if count:
blocksize = count - total_sent
blocksize = min(count - total_sent, blocksize)
if blocksize <= 0:
break
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix possible :exc:`OverflowError` in :meth:`socket.socket.sendfile` when pass
*count* larger than 2 GiB on 32-bit platform.

0 comments on commit d4dfad2

Please sign in to comment.