Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. pyo3
  4. ›
  5. GHSA-36hh-v3qg-5jq4

GHSA-36hh-v3qg-5jq4: PyO3 has an Out-of-bounds Read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators

June 12, 2026

PyO3 0.24.0 added optimized implementations of Iterator::nth and DoubleEndedIterator::nth_back for the BoundListIterator and BoundTupleIterator types. These implementations computed the target index using unchecked usize addition (index + n) before bounds-checking against the sequence length, then read the element via get_item_unchecked.

In nth methods, a sufficiently large n (combined with a non-zero internal index) could cause the addition to overflow and wrap around, producing a small “target index” that passed the bounds check and enabling reads at the front of the list or tuple of elements previously yielded by the iterator.

In nth_back methods, a sufficiently large n could cause underflow in a similar fashion, however would instead allow reads of arbitrary memory past the end of the list or tuple storage.

References

  • github.com/PyO3/pyo3/pull/6086
  • github.com/advisories/GHSA-36hh-v3qg-5jq4
  • rustsec.org/advisories/RUSTSEC-2026-0176.html

Code Behaviors & Features

Detect and mitigate GHSA-36hh-v3qg-5jq4 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 0.29.0

Fixed versions

  • 0.29.0

Solution

Upgrade to version 0.29.0 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-125: Out-of-bounds Read

Source file

cargo/pyo3/GHSA-36hh-v3qg-5jq4.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:27 +0000.