mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-27397: Make email module properly handle invalid-length base64 strings (#7583)
When attempting to base64-decode a payload of invalid length (1 mod 4), properly recognize and handle it. The given data will be returned as-is, i.e. not decoded, along with a new defect, InvalidBase64LengthDefect.
This commit is contained in:
parent
5a98209180
commit
c3f55be7dd
7 changed files with 70 additions and 18 deletions
|
|
@ -108,3 +108,7 @@ All defect classes are subclassed from :class:`email.errors.MessageDefect`.
|
|||
* :class:`InvalidBase64CharactersDefect` -- When decoding a block of base64
|
||||
encoded bytes, characters outside the base64 alphabet were encountered.
|
||||
The characters are ignored, but the resulting decoded bytes may be invalid.
|
||||
|
||||
* :class:`InvalidBase64LengthDefect` -- When decoding a block of base64 encoded
|
||||
bytes, the number of non-padding base64 characters was invalid (1 more than
|
||||
a multiple of 4). The encoded block was kept as-is.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue