summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-02-23 19:30:59 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-02-23 19:30:59 (GMT)
commit664553a778dd10a854c554d309c78de012813629 (patch)
tree6a74677717ba7f1c2a270a67c201d1dad0d09774
parent37d4f7bc0c3b9c6e2bd858873c691c9d2bf091ae (diff)
downloadcpython-664553a778dd10a854c554d309c78de012813629.zip
cpython-664553a778dd10a854c554d309c78de012813629.tar.gz
cpython-664553a778dd10a854c554d309c78de012813629.tar.bz2
#1389051, #1092502: fix excessively large allocations when using read() on a socket
-rw-r--r--Lib/socket.py2
-rw-r--r--Misc/NEWS3
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 0082e76..f79b282 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -305,7 +305,7 @@ class _fileobject(object):
self._rbuf = ""
while True:
left = size - buf_len
- recv_size = max(self._rbufsize, left)
+ recv_size = min(self._rbufsize, left)
data = self._sock.recv(recv_size)
if not data:
break
diff --git a/Misc/NEWS b/Misc/NEWS
index 0926e7f..e04cb3c 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,9 @@ Library
- Bug #1389051: imaplib causes excessive memory fragmentation when reading
large messages.
+- Bug #1389051, 1092502: fix excessively large memory allocations when
+ calling .read() on a socket object wrapped with makefile().
+
- Bug #1433694: minidom's .normalize() failed to set .nextSibling for
last child element.