Merged revisions 77508 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r77508 | antoine.pitrou | 2010-01-15 01:27:43 +0100 (ven., 15 janv. 2010) | 10 lines

  Merged revisions 77506 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r77506 | antoine.pitrou | 2010-01-15 01:18:00 +0100 (ven., 15 janv. 2010) | 4 lines

    Issue #7701: Fix crash in binascii.b2a_uu() in debug mode when given a
    1-byte argument.  Patch by Victor Stinner.
  ........
................
This commit is contained in:
Antoine Pitrou 2010-01-15 00:31:01 +00:00
parent 0560e8a8f8
commit 46e4dd21c4
3 changed files with 7 additions and 1 deletions

View file

@ -294,7 +294,7 @@ binascii_b2a_uu(PyObject *self, PyObject *args)
}
/* We're lazy and allocate to much (fixed up later) */
if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) {
if ( (rv=PyBytes_FromStringAndSize(NULL, 2 + (bin_len+2)/3*4)) == NULL ) {
PyBuffer_Release(&pbin);
return NULL;
}