This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: binascii.a2b_base64 with non base64 data
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: makaron, nnorwitz
Priority: normal Keywords:

Created on 2002-12-19 17:20 by makaron, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (2)
msg13659 - (view) Author: Grzegorz Makarewicz (makaron) Date: 2002-12-19 17:20
python 2.2.2 or cvs, platform any

binascii.a2b_base64 allocates buffer for data at
startup, at end data it truncated to decoded size if it
is bigger than 0, but what about invalid data where
every character is non base64 - space, \r,\n ?

Buffer remains allocated to bin_len but resulting data
length is 0 and it isnt truncated as random data will
be returned

demo.py
import base64
data = '\n'
result = base64.decodestring(data)
print map(ord,result)
msg13660 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2004-06-06 20:07
Logged In: YES 
user_id=33168

This problem appears to be fixed in Python 2.3+.
History
Date User Action Args
2022-04-10 16:06:02adminsetgithub: 37630
2002-12-19 17:20:42makaroncreate