-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Assignments leave their place partially-destroyed if the destructor panics #30380
Labels
A-destructors
Area: Destructors (`Drop`, …)
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
arielb1
added
I-wrong
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Dec 14, 2015
cc me |
It must be noted that the assigned location is supposed to be borrowed mutably while the drop glue is called, so underhanded tricks used by the drop-glue to get a reference to that location (e.g. #30228, which led to the discovery of this issue) are just aliasing-UB. |
cc me. |
triage: P-medium |
pnkfelix
added
A-destructors
Area: Destructors (`Drop`, …)
and removed
I-nominated
labels
Jan 7, 2016
This is causing problems to my non-zeroing-drop work. |
bstrie
added
the
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
label
May 25, 2016
arielb1
added a commit
to arielb1/rust
that referenced
this issue
May 27, 2016
this introduces a DropAndReplace terminator as a fix to rust-lang#30380. That terminator is suppsoed to be translated by desugaring during drop elaboration, which is not implemented in this commit, so this breaks `-Z orbit` temporarily.
arielb1
added a commit
to arielb1/rust
that referenced
this issue
May 27, 2016
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Jun 3, 2016
this introduces a DropAndReplace terminator as a fix to rust-lang#30380. That terminator is suppsoed to be translated by desugaring during drop elaboration, which is not implemented in this commit, so this breaks `-Z orbit` temporarily.
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Jun 3, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-destructors
Area: Destructors (`Drop`, …)
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
STR
Results
The assignment to
*b.0
withinfoo
calls the drop-glue for the value inside. The new tuple("~", Bomb)
is created, and then the drop glue for the old value ofb
is executed. It first frees the original string, and then attempts to callsBomb
's destructor. As the latter destructor panics, the function unwinds without storing a value in the place of the missingString
, leaving a&mut
reference that points to an invalid value, which can later be observed by a destructor orrecover
.Fixes
The new value for the destination is available the whole time - the panic handler can just write it in.
The text was updated successfully, but these errors were encountered: