-
Notifications
You must be signed in to change notification settings - Fork 353
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
ensure that integers cast to pointers will never point at a valid alloc, not even the zst alloc #81
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
921f5af
ensure that integers cast to pointers will never point at a valid all…
oli-obk b2d476e
`type_size` now returns `None` for unsized types
oli-obk 1c40fb0
report the bad integer size instead of just the fact that it is bad
oli-obk d42a7d0
fix null optimizations for smaller than pointer enums
oli-obk 75f56eb
fix field indexing into fat pointers
oli-obk f71c31c
cannot index into non-fat-pointers
oli-obk 2c34d65
also address TyStr in the null pointer optimization
oli-obk 511fa40
add test for int -> fn ptr cast
oli-obk 4a39c22
minor fixes
oli-obk 14ff641
make sure ByVal pointers act just like ByRef to a pointer
oli-obk 13f22f8
print traces only when not running on the rust run-pass test suite (s…
oli-obk f77a0ab
fix writing int->ptr transmuted primvals to memory
oli-obk e2091ff
add more atomic intrinsics
oli-obk 1549c2d
erase all lifetimes from function types before creating pointers to them
oli-obk 4748587
fix creation of simd types
oli-obk 5ee75c0
don't print in the binop tests
oli-obk 1c5c6cd
allow zsts in the zero case of a nullable pointer optimized enum
oli-obk 64155ff
implement fn item -> trait object conversion
oli-obk fd68670
merge closures and function and implement some closure vtable cases
oli-obk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -533,8 +533,8 @@ impl<'a, 'tcx> Memory<'a, 'tcx> { | |
} | ||
|
||
pub fn write_primval(&mut self, dest: Pointer, val: PrimVal) -> EvalResult<'tcx, ()> { | ||
if let Some(ptr) = val.try_as_ptr() { | ||
return self.write_ptr(dest, ptr); | ||
if let Some(alloc_id) = val.relocation { | ||
return self.write_ptr(dest, Pointer::new(alloc_id, val.bits as usize)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not your mistake, just making a note for posterity: this |
||
} | ||
|
||
use primval::PrimValKind::*; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn main() { | ||
let g = unsafe { | ||
std::mem::transmute::<usize, fn(i32)>(42) | ||
}; | ||
|
||
g(42) //~ ERROR tried to use an integer pointer or a dangling pointer as a function pointer | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so much clearer. :D