{"id":"RUSTSEC-2026-0176","revision":"7b4c4b025f864d3eb078637f4bb2aa4a","records":[{"revision":"7b4c4b025f864d3eb078637f4bb2aa4a","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"RUSTSEC-2026-0176","aliases":["GHSA-36hh-v3qg-5jq4"],"title":"Out-of-bounds read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators","description":"PyO3 0.24.0 added optimized implementations of `Iterator::nth` and\n`DoubleEndedIterator::nth_back` for the `BoundListIterator` and\n`BoundTupleIterator` types. These implementations computed the target index\nusing unchecked `usize` addition (`index + n`) before bounds-checking against\nthe sequence length, then read the element via `get_item_unchecked`.\n\nIn `nth` methods, a sufficiently large `n` (combined with a non-zero internal\nindex) could cause the addition to overflow and wrap around, producing a small\n\"target index\" that passed the bounds check and enabling reads at the front\nof the `list` or `tuple` of elements previously yielded by the iterator.\n\nIn `nth_back` methods, a sufficiently large `n` could cause underflow in a\nsimilar fashion, however would instead allow reads of arbitrary memory past\nthe end of the `list` or `tuple` storage.\n\nPyO3 0.29.0 has corrected these methods to use checked arithmetic at the\npositions which could be at risk of overflow.","state":0,"publishedAt":"2026-06-11T12:00:00+00:00","modifiedAt":"2026-06-13T06:30:04.3985729+00:00","affected":[{"ecosystem":"crates.io","name":"pyo3","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.24.0"},{"kind":"fixed","version":"0.29.0"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[],"references":["https://crates.io/crates/pyo3","https://rustsec.org/advisories/RUSTSEC-2026-0176.html","https://github.com/PyO3/pyo3/pull/6086"],"sourceUrl":"https://osv.dev/vulnerability/RUSTSEC-2026-0176","license":"OSV · upstream source license applies","key":"osv:RUSTSEC-2026-0176","identifiers":["RUSTSEC-2026-0176","GHSA-36hh-v3qg-5jq4"]},"retained":false,"historicalAffected":[]}],"coverage":[]}