From: bfis Date: Tue, 24 Aug 2021 10:43:19 +0000 (+0200) Subject: Avoid 2GB write limitation on SSLIOStream X-Git-Tag: v6.2.0b1~39^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bd666cb4739939285645dd58afb10229d3f3337;p=thirdparty%2Ftornado.git Avoid 2GB write limitation on SSLIOStream --- diff --git a/tornado/iostream.py b/tornado/iostream.py index 86235f4dc..e0ec51334 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -1566,6 +1566,11 @@ class SSLIOStream(IOStream): return future def write_to_fd(self, data: memoryview) -> int: + # clip buffer size at 1GB since SSL sockets only support upto 2GB + # this change in behaviour is transparent, since the function is + # already expected to (possibly) read less than the provided buffer + if len(data) >> 30: + data = memoryview(data)[: 1 << 30] try: return self.socket.send(data) # type: ignore except ssl.SSLError as e: