apache / apache/teaclave-sgx-sdk
cannot transmute between types of different sizes, or dependently-sized types
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 268
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to build the `sgx-types` dependency for [my project](https://github.com/encointer/encointer-app/commit/d55f748d915fc701a023eab86fcf2cc777d0b07b). I get the following error:
```
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> /home/abrenzikofer/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/4508450/sgx_types/src/macros.rs:115:24
|
115 | unsafe{macros::transmute([0u8; $size])}
| ^^^^^^^^^^^^^^^^^
|
::: /home/abrenzikofer/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/4508450/sgx_types/src/types.rs:1413:1
|
1413 | / impl_struct_default! {
1414 | | sgx_ql_qv_supplemental_t, 120;
1415 | | }
| |_- in this macro invocation
|
= note: source type: `[u8; 120]` (960 bits)
= note: target type: `types::sgx_ql_qv_supplemental_t` (928 bits)
```
I'm building with
```
export CC=i686-linux-android16-clang
cargo +nightly-2019-10-04-x86_64-unknown-linux-gnu build --target i686-linux-android --release
```
The same thing worked with v1.0.9 but it fails with v1.1.0
Also, it works with other targets (armv7-linux-androideabi and aarch64-linux-android)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the i686-linux-android release build with nightly-2019-10-04 and inspect sgx_types/src/macros.rs at the transmute and sgx_types/src/types.rs around sgx_ql_qv_supplemental_t. Compare the generated type size and default macro invocation between v1.0.9 and v1.1.0, then verify that the corrected build succeeds for i686 while the armv7 and aarch64 targets continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100