Open nox opened 6 years ago
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.
JNIScope
Drop
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
Thanks for reviewing this. Yep, we can make the fields private and add getter functions to prevent users from creating JNIScopes without attach()
JNIScope
is a struct with only public fields (which means anyone is free to build new ones), but itsDrop
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