Author dniq
Recipients dniq
Date 2018-06-04.19:53:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528142011.45.0.592728768989.issue33770@psf.upfronthosting.co.za>
In-reply-to
Content
All base64 decoding methods fail to decode a valid base64 string, throwing 'incorrect padding' regardless of the string padding.

Here's an example:

>>> base64.urlsafe_b64decode('AQAAQDhAAMAAQAAAAAAAAthAAAAJDczODFmZDM2LTNiOTYtNDVmYS04MjQ2LWRkYzJkMmViYjQ2YQ===')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/export/apps/python/3.6/lib/python3.6/base64.py", line 133, in urlsafe_b64decode
    return b64decode(s)
  File "/export/apps/python/3.6/lib/python3.6/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

The same string gets decoded without any issues using Perl's MIME::Base64 module or Java. So far Python's base64 module is the only one that fails to decode it.
History
Date User Action Args
2018-06-04 19:53:31dniqsetrecipients: + dniq
2018-06-04 19:53:31dniqsetmessageid: <1528142011.45.0.592728768989.issue33770@psf.upfronthosting.co.za>
2018-06-04 19:53:31dniqlinkissue33770 messages
2018-06-04 19:53:31dniqcreate