Panic safety issue in Zip::next_back()
TrustedRandomAccess specialization
#86443
Labels
A-iterators
Area: Iterators
C-bug
Category: This is a bug.
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
rust/library/core/src/iter/adapters/zip.rs
Lines 296 to 301 in 312b894
rust/library/core/src/iter/adapters/zip.rs
Lines 235 to 244 in 312b894
Yet another soundness bug in Zip's TRA specialization. Line 300 is not called when line 298 panics. This leaves
self.a_len
outdated, which results in calling__iterator_get_unchecked()
with an invalid index in line 242.Here is a playground link that demonstrates creating two mutable references to the same memory location without unsafe code.
The text was updated successfully, but these errors were encountered: