Skip to content

Report memory exposure in PyO3 nth_back iterator methods#2958

Merged
djc merged 1 commit into
rustsec:mainfrom
davidhewitt:pyo3-nth-back
Jun 11, 2026
Merged

Report memory exposure in PyO3 nth_back iterator methods#2958
djc merged 1 commit into
rustsec:mainfrom
davidhewitt:pyo3-nth-back

Conversation

@davidhewitt

Copy link
Copy Markdown
Contributor

Affected crate(s)

  • pyo3 (40M recent downloads per crates.io)

Links to upstream issue(s) or PR(s)

PyO3/pyo3#6086

Severity

Code that uses BoundListIterator and BoundTupleIterator's nth_back methods with attacker-controlled N are vulnerable to out-of-bound reads if the iterators have already yielded items.

My assessment is that this is a relatively niche iterator method with a couple of conditions to make it a problem, but code meeting the vulnerable combination could easily go undetected and deserves both a fix and an advisory.

Checklist

  • Advisory filename(s) starts with RUSTSEC-0000-0000 as the ID
  • date field is set to the public disclosure date
  • Contains a concise and descriptive title after advisory metadata
  • Asked maintainer(s) if publishing an advisory is appropriate

@davidhewitt davidhewitt changed the title report memory exposure in PyO3 nth_back iterator methods Report memory exposure in PyO3 nth_back iterator methods Jun 11, 2026

@djc djc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@djc djc merged commit 124b56d into rustsec:main Jun 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants