Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

JNIScope is unsound #20

Open
nox opened this issue Mar 16, 2018 · 1 comment
Open

JNIScope is unsound #20

nox opened this issue Mar 16, 2018 · 1 comment

Comments

@nox
Copy link
Contributor

nox commented Mar 16, 2018

JNIScope is a struct with only public fields (which means anyone is free to build new ones), but its Drop implementation dereferences raw pointers to call FFI functions on them. this is unsound.

https://github.com/MortimerGoro/rust-webvr/blob/cab969ee734908ebaac7667bbd4cd903e2135dd5/rust-webvr-api/src/jni_utils.rs#L9-L13

https://github.com/MortimerGoro/rust-webvr/blob/cab969ee734908ebaac7667bbd4cd903e2135dd5/rust-webvr-api/src/jni_utils.rs#L90-L98

@MortimerGoro
Copy link
Contributor

Thanks for reviewing this. Yep, we can make the fields private and add getter functions to prevent users from creating JNIScopes without attach()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants