diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-01-16 11:53:02 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-16 11:53:02 (GMT) |
| commit | 045adb1ad893ce350ac40e180da44523d03361a0 (patch) | |
| tree | bca21e3ebf0b89e82e6fa42d8d447fbac6ff8818 | |
| parent | 2b025793e122717d5b021f33079e632d54cf6052 (diff) | |
| download | cpython-045adb1ad893ce350ac40e180da44523d03361a0.zip cpython-045adb1ad893ce350ac40e180da44523d03361a0.tar.gz cpython-045adb1ad893ce350ac40e180da44523d03361a0.tar.bz2 | |
[3.12] gh-114077: Fix OverflowError in socket.sendfile() when pass count >2GiB (GH-114079) (GH-114110)
(cherry picked from commit d4dfad2aa9e76038302b0c5a29ebacc2723ed50d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
| -rw-r--r-- | Lib/socket.py | 2 | ||||
| -rw-r--r-- | Misc/NEWS.d/next/Library/2024-01-15-12-12-54.gh-issue-114077.KcVnfj.rst | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index 321fcda..42ee130 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -382,7 +382,7 @@ class socket(_socket.socket): 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: diff --git a/Misc/NEWS.d/next/Library/2024-01-15-12-12-54.gh-issue-114077.KcVnfj.rst b/Misc/NEWS.d/next/Library/2024-01-15-12-12-54.gh-issue-114077.KcVnfj.rst new file mode 100644 index 0000000..dba086f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-01-15-12-12-54.gh-issue-114077.KcVnfj.rst @@ -0,0 +1,2 @@ +Fix possible :exc:`OverflowError` in :meth:`socket.socket.sendfile` when pass +*count* larger than 2 GiB on 32-bit platform. |
