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

Scope API is unsound #9

Closed
jonas-schievink opened this issue Jan 11, 2019 · 4 comments
Closed

Scope API is unsound #9

jonas-schievink opened this issue Jan 11, 2019 · 4 comments

Comments

@jonas-schievink
Copy link

Scope::new takes 2 *mut Option<_> parameters, but the rest of the Scope API assumes that those raw pointers are valid. For example, the public get_yield method does the following:

let para = unsafe { &mut *self.para };
para.take()

Calling Scope::new with invalid (null, misaligned or dangling) pointers is possible in safe Rust, and get_yield can also be called from safe Rust, therefore this API is unsound.

Either Scope::new should be marked unsafe, or it should take &'a mut Option<_> instead of raw pointers, adding a lifetime parameter to Scope.

@jonas-schievink jonas-schievink changed the title Scope::new is unsound Scope API is unsound Jan 11, 2019
Xudong-Huang added a commit that referenced this issue Feb 18, 2019
@Xudong-Huang
Copy link
Owner

thanks for the advise. I just remove the unsafe get_scope and add scoped_init API

@Xudong-Huang
Copy link
Owner

I think this can be closed. It's all in 0.6.12

@Shnatsel
Copy link

Accessing a dangling pointer is usually an exploitable vulnerability. Please file a security advisory at https://github.com/RustSec/advisory-db so that users of this crate can check if they're running a vulnerable version and upgrade.

Also, please consider yanking affected versions.

@Xudong-Huang
Copy link
Owner

Thanks for the info. I will do it in next release.

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

No branches or pull requests

3 participants