Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
>>>importbinascii>>>f=lambdas:binascii.a2b_base64(s,strict_mode=True)>>>f('AAAA')b'\x00\x00\x00'>>>f('AAAA=')b'\x00\x00\x00'>>>f('AAAA==')b'\x00\x00\x00'>>>f('AAAA===')b'\x00\x00\x00'>>>f('AAAA====')b'\x00\x00\x00'>>>f('AAAA=====')b'\x00\x00\x00'
Doc/library/binascii.rst defines that a valid base64 "Contains no excess data after padding (including excess padding, newlines, etc.)". However, current implement does not handle the edge case of excess padding after no padding.
CPython versions tested on:
3.12
Operating systems tested on:
macOS