Implementing a trait allows changing lifetime requirements, leading to memory corruption #35730
Labels
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This code snipped, when compiled locally on OSX segfaults on stable (1.10.0) and exhibits memory corruption on nightly:
I believe the issue here is that the implementation of the
A
trait allows application of the'static
bound, enabling the implementation of that function to assume that. The trait, however, uses the'a
bound. When calling this function we can then feed in non-'static
lifetimes and wind up corrupting data.cc @nikomatsakis
cc @arielb1
cc @rust-lang/compiler
The text was updated successfully, but these errors were encountered: