diff options
author | J. Nick Koston <nick@koston.org> | 2023-07-23 04:07:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-23 04:07:14 (GMT) |
commit | 9eeb4b485f4f9e13e5cb638e43a0baecb3ff4e86 (patch) | |
tree | 76de961ab48cb998b9476663f62a37f25f6e823d /Lib/asyncio | |
parent | 7fc9be350af055538e70ece8d7de78414bad431e (diff) | |
download | cpython-9eeb4b485f4f9e13e5cb638e43a0baecb3ff4e86.zip cpython-9eeb4b485f4f9e13e5cb638e43a0baecb3ff4e86.tar.gz cpython-9eeb4b485f4f9e13e5cb638e43a0baecb3ff4e86.tar.bz2 |
gh-82500: Fix asyncio sendfile overflow on 32bit (#107056)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/unix_events.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 17fb4d5..a268086 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -394,6 +394,9 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): fut.set_result(total_sent) return + # On 32-bit architectures truncate to 1GiB to avoid OverflowError + blocksize = min(blocksize, sys.maxsize//2 + 1) + try: sent = os.sendfile(fd, fileno, offset, blocksize) except (BlockingIOError, InterruptedError): |