New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base64.b32decode() leads into UnboundLocalError and OverflowError on some data #78345
Comments
base64.b32decode() function leads into "UnboundLocalError: local variable 'acc' referenced before assignment" when passing 8 equality signs as data: >>> import base64
>>> base64.b32decode(b"========")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/python-3.7-bin/lib/python3.7/base64.py", line 235, in b32decode
acc <<= 5 * padchars
UnboundLocalError: local variable 'acc' referenced before assignment When passing a different number of equality signs, the documented binascii.Error exception is thrown. |
Apparently base64.b32decode() also has another issue that I missed when going through the issues with base64 module: >>> import base64
>>> base64.b32decode(b"M===============================")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/python-3.7-bin/lib/python3.7/base64.py", line 236, in b32decode
last = acc.to_bytes(5, 'big')
OverflowError: int too big to convert |
Thank you for your report Jussi. The type "crash" is used for hard crashes of the Python interpreter – possibly with a core dump or a Windows error box. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: