[Python-checkins] r77506 - in python/trunk: Lib/test/test_binascii.py Misc/NEWS Modules/binascii.c
antoine.pitrou
python-checkins at python.org
Fri Jan 15 01:18:01 CET 2010
Author: antoine.pitrou
Date: Fri Jan 15 01:18:00 2010
New Revision: 77506
Log:
Issue #7701: Fix crash in binascii.b2a_uu() in debug mode when given a
1-byte argument. Patch by Victor Stinner.
Modified:
python/trunk/Lib/test/test_binascii.py
python/trunk/Misc/NEWS
python/trunk/Modules/binascii.c
Modified: python/trunk/Lib/test/test_binascii.py
==============================================================================
--- python/trunk/Lib/test/test_binascii.py (original)
+++ python/trunk/Lib/test/test_binascii.py Fri Jan 15 01:18:00 2010
@@ -109,6 +109,9 @@
self.assertRaises(binascii.Error, binascii.b2a_uu, 46*"!")
+ # Issue #7701 (crash on a pydebug build)
+ self.assertEqual(binascii.b2a_uu('x'), '!> \n')
+
def test_crc32(self):
crc = binascii.crc32("Test the CRC-32 of")
crc = binascii.crc32(" this string.", crc)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Jan 15 01:18:00 2010
@@ -33,6 +33,9 @@
Library
-------
+- Issue #7701: Fix crash in binascii.b2a_uu() in debug mode when given a
+ 1-byte argument. Patch by Victor Stinner.
+
- Issue #3299: Fix possible crash in the _sre module when given bad
argument values in debug mode. Patch by Victor Stinner.
Modified: python/trunk/Modules/binascii.c
==============================================================================
--- python/trunk/Modules/binascii.c (original)
+++ python/trunk/Modules/binascii.c Fri Jan 15 01:18:00 2010
@@ -294,7 +294,7 @@
}
/* We're lazy and allocate to much (fixed up later) */
- if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) {
+ if ( (rv=PyString_FromStringAndSize(NULL, 2 + (bin_len+2)/3*4)) == NULL ) {
PyBuffer_Release(&pbin);
return NULL;
}
More information about the Python-checkins
mailing list