Skip to content

Add overflow checks before calling memory allocators #127681

Open
@picnixz

Description

@picnixz

Bug report

Bug description:

From capi-workgroup/decisions#50 (comment) and capi-workgroup/decisions#50 (comment).

Some calls to the PyMem_* API uses an arithmetic operation on the size, which could make the requested length overflow. The checks in the corresponding functions would not be relevant since the inputs already overflowed.

See #127686 (comment) for the future of this issue.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)staleStale PR or inactive for long period of time.type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions