ios-jsc
ios-jsc copied to clipboard
Structs with vector fields don't have proper padding
If there is no issue for your problem, tell us about it
Due to data types alignment requirements which are not taken into account in the runtime some structures' ffi types are not created properly. The ffi type of the struct from the example below should have size of 32 bytes while it is 24 bytes which causes a heap overflow.
Please, provide the following version numbers that your issue occurs with:
- Runtime(s): 4.1.1
Please, tell us how to recreate the issue in as much detail as possible.
The following struct will cause a heap overflow as the padding for the second field is not considered.
typedef struct StructWithVectorAndDouble {
simd_float4 fl4;
double dbl;
} StructWithVectorAndDouble
For examples and explanation of the padding requirements see here.