&'s T
→ &'static T
in safe code (UAF)
#132186
Labels
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-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: argument requires that
s
is borrowed for'static
Instead, this happened: code compiles successfully and the excution potentially triggers Use-After-Free on the String
local
.rogram returned: 0 Program stderr [/app/example.rs:21:5] s = "UAF!"
This seems very much like a Use-After-Free issue, and it's quite likely related to the compiler.It can be reproduced in the latest version of the Rust compiler.
rustc --version --verbose
:note: This issue appears to be different from #114936, which was related to the
Fn*
Trait and was fixed in version 1.78; whereas this problem can still trigger a vulnerability in the latest version.The text was updated successfully, but these errors were encountered: