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

gh-146311: Reject non-zero padding bits in base64/base32 decoding#146312

Draft
gpshead wants to merge 3 commits intopython:mainfrom
gpshead:gh-146311-nonzero-padding-bits
Draft

gh-146311: Reject non-zero padding bits in base64/base32 decoding#146312
gpshead wants to merge 3 commits intopython:mainfrom
gpshead:gh-146311-nonzero-padding-bits

Conversation

@gpshead
Copy link
Member

@gpsheadgpshead commentedMar 22, 2026
edited by bedevere-appbot
Loading

Summary

  • a2b_base64: reject non-zero padding bits whenstrict_mode=True
  • a2b_base32: reject non-zero padding bits unconditionally
  • Fix existing test data that incidentally had non-zero padding bits

PerRFC 4648 section 3.5, decoders MAY reject encodings where pad bits are not zero.

gpsheadand others added2 commitsMarch 22, 2026 15:05
RFC 4648 section 3.5 allows decoders to reject encoded data containingnon-zero pad bits. Both a2b_base64 (strict_mode=True) and a2b_base32currently silently discard non-zero trailing bits instead of raisingbinascii.Error. These tests document the expected behavior.Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add leftchar validation after the main decode loop in a2b_base64(strict_mode only) and a2b_base32 (always). Fix existing test datathat incidentally had non-zero padding bits to use characters withzero trailing bits while preserving the same decoded output.Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gpsheadgpsheadforce-pushed thegh-146311-nonzero-padding-bits branch from8451e22 to0ca2563CompareMarch 22, 2026 22:07
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gpshead
Copy link
MemberAuthor

discussing if base32 needs strict_mode on the issue. not adding a NEWS entry until that is decided.

@gpsheadgpshead self-assigned thisMar 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@gpsheadgpshead

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@gpshead

[8]ページ先頭

©2009-2026 Movatter.jp