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

Keep only the largest field as the public field #14

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from

Commits on Jun 10, 2022

  1. Keep only the largest field as the public field

    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
    shepmaster committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    a183564 View commit details
    Browse the repository at this point in the history