New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

If validate=True is passed to base64.b64decode(), it should raise a 
binascii.Error if the input contains any character not from the acceptable 
alphabet.

But it does not raise if the input ends with a single \n. It raises if the 
input ends with a multiple \n or with any other whitespace character. Only a 
single \n is accepted.

This is an implementation artifact. A regular exception ending with $ is used 
to validate an input. But $ matches not only end of string. It matches also an 
empty string before the trailing \n.

Similar errors are also occurred in other sites. I'll open separate issues for 
different cases.

----------
components: Library (Lib)
messages: 358438
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: base64.b64decode() with validate=True does not raise for a trailing \n
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39055>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to