Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

binascii base64 & base32 decode ignore excess padding bits in their input #146311

Open
Assignees
gpsheadserhiy-storchaka
Labels
extension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@gpshead

Description

@gpshead

Bug description:

CPython has had this behavior forever on these, but base64 and base32 decode both ignore excess bits in their input data. Perhttps://datatracker.ietf.org/doc/html/rfc4648.html#section-3.5"decodersMAY chose to reject an encoding if the pad bits have not been set to zero".

a2b_base64() has astrict_mode= option, so doing this in that mode makes sense.

base32 is documented as always being strict so just fixing its glitch there makes sense to me. Wecould add astrict_mode= parameter toa2b_base32() but that would be a little sad. I doubt anyone depends on a behavior like this. It is unnatural to have excess bits in encoded data because encoders MUST (per the rfc) set those bits to 0.

This is a follow on to these recent changes:

CPython versions tested on:

3.15alpha

Linked PRs

Metadata

Metadata

Labels

extension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2026 Movatter.jp