python / python/cpython

Potential integer overflow in instrumentation.c

Open
#135,177 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

The arithmetic expression to * (int)sizeof(_Py_CODEUNIT) can overflow if the number of instructions in a function exceeds MAX_INT / 2, as to represents the instruction offset and sizeof(_Py_CODEUNIT) is 2.
https://github.com/python/cpython/blob/4b44b3409ac026e7f13054a3daa18ab7ee14d85c/Python/instrumentation.c#L1239

Linked PRs
  • gh-135179
  • gh-135202

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Python/instrumentation.c around line 1239 and inspect the arithmetic expression identified in the issue. Review linked PRs gh-135179 and gh-135202 first; done means the potential overflow is addressed and the relevant CPython checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.