Skip to content

PY_SSIZE_T_MIN negate UB in unicode_format.c and bytesobject.c #151847

Description

@aisk

Bug report

Bug description:

Original gist: https://gist.github.com/devdanzin/577421b083bad6802aa391b909d1a725

unicode_format_arg_parse (line 563): -PY_SSIZE_T_MIN is undefined behavior in C. Benign on two's-complement but technically UB. bytesobjects.c have the same problem.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions