mirror of https://github.com/python/cpython.git
Address a bug in the uuencode decoder, reported bu "donut" in SF bug
#127718: '@' and '`' seem to be confused.
This commit is contained in:
parent
dcf5715db1
commit
92d8917f83
|
@ -204,7 +204,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
|
||||||
/* Check the character for legality
|
/* Check the character for legality
|
||||||
** The 64 in stead of the expected 63 is because
|
** The 64 in stead of the expected 63 is because
|
||||||
** there are a few uuencodes out there that use
|
** there are a few uuencodes out there that use
|
||||||
** '@' as zero instead of space.
|
** '`' as zero instead of space.
|
||||||
*/
|
*/
|
||||||
if ( this_ch < ' ' || this_ch > (' ' + 64)) {
|
if ( this_ch < ' ' || this_ch > (' ' + 64)) {
|
||||||
PyErr_SetString(Error, "Illegal char");
|
PyErr_SetString(Error, "Illegal char");
|
||||||
|
@ -232,8 +232,8 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
|
||||||
*/
|
*/
|
||||||
while( ascii_len-- > 0 ) {
|
while( ascii_len-- > 0 ) {
|
||||||
this_ch = *ascii_data++;
|
this_ch = *ascii_data++;
|
||||||
/* Extra '@' may be written as padding in some cases */
|
/* Extra '`' may be written as padding in some cases */
|
||||||
if ( this_ch != ' ' && this_ch != '@' &&
|
if ( this_ch != ' ' && this_ch != ' '+64 &&
|
||||||
this_ch != '\n' && this_ch != '\r' ) {
|
this_ch != '\n' && this_ch != '\r' ) {
|
||||||
PyErr_SetString(Error, "Trailing garbage");
|
PyErr_SetString(Error, "Trailing garbage");
|
||||||
Py_DECREF(rv);
|
Py_DECREF(rv);
|
||||||
|
|
Loading…
Reference in New Issue