mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Valgrind was reporting an uninitialized read for bad input.
This fixes the problem and the test passes. I'm not sure the test is really correct though. It seems like it would be better to raise an exception. I think that wasn't done for backwards compatability. Bugfix candidate.
This commit is contained in:
parent
7b0a5057af
commit
fe92eef85b
1 changed files with 2 additions and 1 deletions
|
@ -204,7 +204,8 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
|
|||
bin_data = (unsigned char *)PyString_AsString(rv);
|
||||
|
||||
for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) {
|
||||
this_ch = *ascii_data;
|
||||
/* XXX is it really best to add NULs if there's no more data */
|
||||
this_ch = (ascii_len > 0) ? *ascii_data : 0;
|
||||
if ( this_ch == '\n' || this_ch == '\r' || ascii_len <= 0) {
|
||||
/*
|
||||
** Whitespace. Assume some spaces got eaten at
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue