python / python/cpython

Issues caused by reading arbitrary number of bytes

Open
#141,713 2 comments 1 reaction 1 assignee View on GitHub

@serhiy-storchaka is already working on this.

Since Nov 18, 2025.

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

Description

This is a meta-issue for a group of similar issues that have the same root cause: reading a number of bytes when the number is specified by the user/external source. Since read(n) is usually implemented by allocating a buffer of size n and then reading into it, this can cause arbitrary memory consumption which leads to swapping.

Linked PRs
  • gh-142022

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.