Skip to content

Incorrect use of _PyLong_CompactValue() #121153

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

There are several errors related to use of _PyLong_CompactValue() in longobject.c.

  • The result has type Py_ssize_t, not intptr_t. Although on most supported platforms it is the same.
  • Type cast from unsigned integer to signed integer and from signed integer to unsigned integer should be explicit.
  • Downcasting should be explicit.

Some of the current code may have undefined behavior.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions