-
Notifications
You must be signed in to change notification settings - Fork 43
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
Safety mistake? when calling binding function #232
Comments
It looks like create_reference is intended to set the pointer, so as long as the allocated pointer size is consistent and create_reference isn't trying to deref that pointer it seems ok. But thats and assumption, the code to create_reference should be checked. |
macro |
But the |
I guess we can mark as unsafe |
It seems like there is a implicit conversion from ptr -> napi_ref that the lib should maybe make more explicit so any ptr can't be converted. If the creation of napi_ref was more protected, then it might be more secure to use the napi_ref. Is create_reference the only way to end up with a napi_ref? |
I am looking into how to make it safe, also meanwhile working on temporary fix to segfault issue. This kind of safety issue is everywhere in the library so seems like we would need to do big refactor to fix it. For example this also seems unsafe to me: node-bindgen/nj-core/src/basic.rs Line 377 in 952a08a
not sure who has the ownership of the |
Shouldn't this be marked
unsafe
?node-bindgen/nj-core/src/basic.rs
Line 328 in 952a08a
If it call this with a null pointer or something like that, it is ub?
The text was updated successfully, but these errors were encountered: