-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zip may call __iterator_get_unchecked twice with the same index #82291
Comments
Assigning |
The gift that keeps on giving 🤣 Maybe it is time to get rid of The upside would be eliminating a lot of code in |
I don't know, I feel like that would just make more complex to upheld the invariants. IMO a good improvement over the current |
I don't see how separating the forward and backward state would help with a drop implementation. The issue is that the source ( |
It would help because it allows the source iterator to keep track of its state by updating it when the method is called. Anyway, looks like someone already tried this approach back in 2016 and it resulted in worse optimizations, but maybe LLVM got better in the meantime, or maybe that implementation could have been better. Anyway I don't think this is the right place to discuss this, a topic on zulip would probably be better. |
|
Prevent specialized ZipImpl from calling `__iterator_get_unchecked` twice with the same index Fixes rust-lang#82291 It's open for review, but conflicts with rust-lang#82289, wait before merging. The conflict involves only the new test, so it should be rather trivial to fix.
Prevent specialized ZipImpl from calling `__iterator_get_unchecked` twice with the same index Fixes rust-lang#82291 It's open for review, but conflicts with rust-lang#82289, wait before merging. The conflict involves only the new test, so it should be rather trivial to fix.
Prevent specialized ZipImpl from calling `__iterator_get_unchecked` twice with the same index Fixes rust-lang#82291 It's open for review, but conflicts with rust-lang#82289, wait before merging. The conflict involves only the new test, so it should be rather trivial to fix.
Prevent specialized ZipImpl from calling `__iterator_get_unchecked` twice with the same index Fixes rust-lang#82291 It's open for review, but conflicts with rust-lang#82289, wait before merging. The conflict involves only the new test, so it should be rather trivial to fix.
Here
__iterator_get_unchecked
is called for potential side effects untilself.index == self.a.size()
, ignoring however that it could have already been called innext_back
with those indexes.rust/library/core/src/iter/adapters/zip.rs
Lines 200 to 208 in 0148b97
Playground link that demonstrates how this can be exploited to get two mutable references to the same data and cause an use-after-free bug.
The text was updated successfully, but these errors were encountered: