summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-30 03:00:52 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-30 03:00:52 (GMT)
commit355bc0c88e3c76f1ab688467f150c519f7b0f80a (patch)
treee7ac1cb164e9a9077abf456f931ef11a10d34dcb
parentd82fb78b5c0a8d9bd319da360881de1f754842c1 (diff)
downloadcpython-355bc0c88e3c76f1ab688467f150c519f7b0f80a.zip
cpython-355bc0c88e3c76f1ab688467f150c519f7b0f80a.tar.gz
cpython-355bc0c88e3c76f1ab688467f150c519f7b0f80a.tar.bz2
Change the limit on the input size for b2a_base64 to what will fit in
memory, rather than the standard's 57. This fixes SF bug #473009.
-rw-r--r--Modules/binascii.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 4ddea56..643450c 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -135,7 +135,9 @@ static char table_a2b_base64[] = {
};
#define BASE64_PAD '='
-#define BASE64_MAXBIN 57 /* Max binary chunk size (76 char line) */
+
+/* Max binary chunk size; limited only by available memory */
+#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject))
static unsigned char table_b2a_base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";