SIGN IN SIGN UP

gh-119511: Fix a potential denial of service in imaplib (#119514)

The IMAP4 client could consume an arbitrary amount of memory when trying
to connect to a malicious server, because it read a "literal" data with a
single read(size) call, and BufferedReader.read() allocates the bytes
object of the specified size before reading. Now the IMAP4 client reads data
by chunks, therefore the amount of used memory is limited by the
amount of the data actually been sent by the server.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
S
Serhiy Storchaka committed
735f25c5e3a0f74438c86468ec4dfbe219d93c91
Parent: 3fb5f6e
Committed by GitHub <noreply@github.com> on 1/27/2025, 1:44:00 PM