Closed
Description
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.
Activity
apiraino commentedon Jun 18, 2021
How close is this to #85873?
the8472 commentedon Jun 18, 2021
The same functions are involved but the aspects that interact to cause unsafety are quite different.
@rustbot claim
Qwaz commentedon Jun 18, 2021
I agree, this is much closer to #81740.
Rollup merge of rust-lang#86452 - the8472:fix-zip-drop-safety, r=m-ou-se
Rollup merge of rust-lang#86452 - the8472:fix-zip-drop-safety, r=m-ou-se
{ChunksMut,ChunksExactMut}::__iterator_get_unchecked()
#94231fix Zip unsoundness (again)
fix Zip unsoundness (again)