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.a2b_base64 strict mode accepts invalid base64 input #118314

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@zhangyoufu

Description

@zhangyoufu

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

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-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-2025 Movatter.jp