Skip to content
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

[miri] Throw UB if target size and data size don't match #71569

Merged
merged 3 commits into from
Apr 26, 2020

Conversation

samrat
Copy link
Contributor

@samrat samrat commented Apr 26, 2020

Issue: rust-lang/miri#1355

If an extern C function is defined as

extern "C" {
    fn malloc(size: u32) -> *mut std::ffi::c_void;
}

on a 64-bit machine(ie. pointer sizes don't match), return undefined behaviour from Miri when converting the argument into machine_usize

If an extern C function is defined as

```
extern "C" {
    fn malloc(size: u32) -> *mut std::ffi::c_void;
}
```

on a 64-bit machine(ie. pointer sizes don't match), throw an undefined
behaviour.
@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 26, 2020
@petrochenkov
Copy link
Contributor

r? @RalfJung

@RalfJung
Copy link
Member

@samrat thanks a lot, this looks great! I just have some minor nits.

@RalfJung
Copy link
Member

I adjusted style a bit more as I had missed that before. Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 26, 2020

📌 Commit c8d8c42 has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#71421 (Add a function to turn Box<T> into Box<[T]>)
 - rust-lang#71537 (Remove support for self-opening)
 - rust-lang#71551 (Minor refactoring around IndexVec usage in generator transformation)
 - rust-lang#71569 ([miri] Throw UB if target size and data size don't match)
 - rust-lang#71576 (check that `AsRef` and `AsMut` are inlined)

Failed merges:

 - rust-lang#71558 (Cleanup and document `-Z tls-model` )

r? @ghost
@bors bors merged commit b2a8a8a into rust-lang:master Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants