Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upExpressions in block tail supposed to outlive block variables dropped early. #33490
Comments
eddyb
added
I-nominated
I-unsound 💥
labels
May 7, 2016
This comment has been minimized.
This comment has been minimized.
eddyb
changed the title
Expressions in block tail incorrectly assumed to outlive block variables.
Expressions in block tail supposed to outlive block variables dropped early.
May 11, 2016
eddyb
added
I-wrong
A-mir
and removed
I-nominated
I-unsound 💥
labels
May 11, 2016
This comment has been minimized.
This comment has been minimized.
|
Updated to reflect that borrowck enforces the semantics we want to support, even though old trans doesn't respect them. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb is the remaining bug here just that old trans does it wrong? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis Correct, as everyone seems to agree that while the scoping semantics regionck/borrowck enforce may appear strange, they're intended. |
This was referenced May 24, 2016
This comment has been minimized.
This comment has been minimized.
Then since old trans doesn't exist anymore, should this be closed? |
This comment has been minimized.
This comment has been minimized.
|
Indeed. |
eddyb
closed this
Nov 3, 2016
This comment has been minimized.
This comment has been minimized.
|
There is a FIXME related to this issue, |
This comment has been minimized.
This comment has been minimized.
|
@Eh2406 Looks like the braces can be removed now. |
eddyb commentedMay 7, 2016
•
edited
Found while investigating the remaining wrong case in #32433. Effectively use-after-free.
Can be used to cause a segmentation fault (check out on playpen):
The
Finepointee drops before theEvilholding of the pointer, and in between those the destructor ofDirtyoverwrites the same heap location of the deallocatedBox<Vec<i32>>with a different 3-usizeBox, causing a segmentation fault on Debug mode and garbage to be printed on Release mode.EDIT: Works fine even with old trans if there is any sort of block nesting (i.e. only the outermost block of a function has the broken behavior) - check out on playpen.
cc @rust-lang/compiler @rust-lang/lang