Closed
Description
rust/library/core/src/iter/adapters/zip.rs
Lines 191 to 211 in e708cbd
rust/library/core/src/iter/adapters/zip.rs
Lines 395 to 396 in e708cbd
There is a panic safety issue in Zip::next()
that allows to call __iterator_get_unchecked()
to the same index twice. __iterator_get_unchecked()
is called at line 204 and the index
is updated at line 206. If line 204 panics, the index is not updated and the subsequent next()
call will use the same index for __iterator_get_unchecked()
. This violates the second safety requirement of TrustedRandomAccess
.
Here is a playground link that demonstrates creating two mutable references to the same memory location without using unsafe Rust.