Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d895b20

Browse files
author
Peter Schneider-Kamp
committed
This closes bug #430849 (internal error produced by binascii.a2b_base64)
1 parent 22adac5 commit d895b20

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/binascii.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ binascii_a2b_base64(PyObject *self, PyObject *args)
335335
if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) )
336336
return NULL;
337337

338+
if ( ascii_len == 0) {
339+
PyErr_SetString(Error, "Cannot decode empty input");
340+
return NULL;
341+
}
338342
bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */
339343

340344
/* Allocate the buffer */

0 commit comments

Comments
 (0)