Skip to content

Rename bindings to prevent overflow in Jest#43

Merged
addaleax merged 2 commits intonode-ffi-napi:latestfrom
acdibble:rename-native-export
Aug 28, 2020
Merged

Rename bindings to prevent overflow in Jest#43
addaleax merged 2 commits intonode-ffi-napi:latestfrom
acdibble:rename-native-export

Conversation

@acdibble
Copy link
Contributor

This is a fix for #16, an issue that appears (especially in tests) when writePointer turns into an infinitely recursive call and overflows the stack.

This PR renames the native binding to already have the underscore to prevent the loop from ever being created.

@coveralls
Copy link

coveralls commented Aug 28, 2020

Coverage Status

Coverage decreased (-0.2%) to 74.414% when pulling 8aae893 on acdibble:rename-native-export into cac6977 on node-ffi-napi:latest.

@addaleax
Copy link
Contributor

If you do this, can you follow through for all native bindings that follow this pattern, since it’s not just writePointer that’s affected as I understand it?

Also, the commit message would ideally point out that this works around a bug in Jest :)

@acdibble acdibble changed the title Rename native binding to prevent infinitely recursive call Rename bindings to prevent overflow in Jest Aug 28, 2020
@acdibble
Copy link
Contributor Author

acdibble commented Aug 28, 2020

Changed all of the native bindings that followed the same pattern. Updated the PR title to mention Jest, but you can feel free to change it to whatever you feel is best.

@addaleax
Copy link
Contributor

Thanks, I’ll merge this after the CI runs :)

@acdibble
Copy link
Contributor Author

Thanks, I appreciate the responsiveness!

@addaleax addaleax merged commit a43eeb5 into node-ffi-napi:latest Aug 28, 2020
addaleax pushed a commit that referenced this pull request Aug 28, 2020
This is a fix for #16, an issue that appears (especially in tests) when `writePointer` turns into an infinitely recursive call and overflows the stack.

This PR renames the native binding to already have the underscore to prevent the loop from ever being created.

This problem seems to surface mostly when using this library inside of Jest tests.

PR-URL: #43
Fixes: #16
@addaleax
Copy link
Contributor

Published in v2.1.2 and v3.0.1, thanks for the PR!

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.

4 participants