mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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:
parent
3ffa43db48
commit
c391ad007b
3 changed files with 7 additions and 1 deletions
|
@ -294,7 +294,7 @@ binascii_b2a_uu(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue