Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added a seperate error message for discontinuous padding
  • Loading branch information
idan22moral committed Jul 19, 2021
commit 00e63a9d864850d99ac33518adb05b8ab2f401e7
7 changes: 5 additions & 2 deletions Modules/binascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ binascii_a2b_base64_impl(PyObject *module, Py_buffer *data, int strict_mode)
unsigned char *bin_data_start = bin_data;

if (strict_mode && ascii_len > 0 && ascii_data[0] == '=') {
malformed_padding:
state = get_binascii_state(module);
if (state) {
PyErr_SetString(state->Error, "Leading padding not allowed");
Expand Down Expand Up @@ -516,7 +515,11 @@ binascii_a2b_base64_impl(PyObject *module, Py_buffer *data, int strict_mode)

// Characters that are not '=', in the middle of the padding, are not allowed
if (strict_mode && padding_started) {
goto malformed_padding;
state = get_binascii_state(module);
if (state) {
PyErr_SetString(state->Error, "Discontinuous padding not allowed");
}
goto error_end;
}
pads = 0;

Expand Down