[Python-checkins] CVS: python/dist/src/Modules binascii.c,2.28,2.28.4.1

Anthony Baxter anthonybaxter@users.sourceforge.net
2001年11月01日 03:30:08 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv700
Modified Files:
 Tag: release21-maint
	binascii.c 
Log Message:
backport fixes from 2.32 and 2.29:
 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.
 This closes bug #430849 (internal error produced by binascii.a2b_base64)
Index: binascii.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v
retrieving revision 2.28
retrieving revision 2.28.4.1
diff -C2 -d -r2.28 -r2.28.4.1
*** binascii.c	2001年01月09日 02:11:57	2.28
--- binascii.c	2001年11月01日 11:30:06	2.28.4.1
***************
*** 127,131 ****
 
 #define BASE64_PAD '='
! #define BASE64_MAXBIN 57	/* Max binary chunk size (76 char line) */
 
 static unsigned char table_b2a_base64[] =
--- 127,133 ----
 
 #define BASE64_PAD '='
! 
! /* Max binary chunk size; limited only by available memory */
! #define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject))
 
 static unsigned char table_b2a_base64[] =
***************
*** 336,339 ****
--- 338,345 ----
 		return NULL;
 
+ 	if ( ascii_len == 0) {
+ 		PyErr_SetString(Error, "Cannot decode empty input");
+ 		return NULL;
+ 	}
 	bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */
 

AltStyle によって変換されたページ (->オリジナル) /