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

[nitpicking] The `Array` trait should be unsafe #8

Closed
tomaka opened this issue Jun 15, 2015 · 1 comment
Closed

[nitpicking] The `Array` trait should be unsafe #8

tomaka opened this issue Jun 15, 2015 · 1 comment

Comments

@tomaka
Copy link
Contributor

@tomaka tomaka commented Jun 15, 2015

It is possible to make the SmallVec segfault with only safe code by writing a wrong implementation of the Array trait:

impl Array for Foo {
    type Item = u8;
    fn size() -> usize { 8 }
    fn ptr(&self) -> *const u8 { std::ptr::null() }
    fn ptr_mut(&mut self) -> *mut u8 { std::ptr::null_mut() }
}
@Manishearth Manishearth reopened this Jun 15, 2015
@Manishearth
Copy link
Member

@Manishearth Manishearth commented Jun 15, 2015

(sorry, just testing a webhook fix)

Manishearth added a commit that referenced this issue Jun 15, 2015
Ms2ger added a commit that referenced this issue Jun 15, 2015
Make Array unsafe (fixes #8); r=Ms2ger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.