Skip to content

Conversation

@shepmaster
Copy link

@shepmaster shepmaster commented Jun 10, 2022

Without this, ffi-napi will iterate through the fields property and sum up the sizes of the member fields. This will cause unions to appear to be larger than they are. This can cause memory corruption on 64-bit x86 Windows when the return type should be 8 bytes (and thus be returned in a register) but ffi-napi makes it into an indirect buffer instead.

Without this, ffi-napi will iterate through the `fields` property
and **sum up** the sizes of the member fields [1]. This will cause
unions to appear to be larger than they are. This can cause memory
corruption on 64-bit x86 Windows when the return type should be 8
bytes (and thus be returned in a register) but ffi-napi makes it into
an indirect buffer instead.

Fixes node-ffi-napi#15

[1]: https://github.com/node-ffi-napi/node-ffi-napi/blob/1e7bbb170462f5f0880350cc4a518a2755b9337f/lib/type.js#L56
@Kreijstal
Copy link

time to fork it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants