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

Unsoundness / Use After Free if a custom Drop impl references other data allocated on the allocator. #1

Closed
TimNN opened this issue Mar 22, 2024 · 2 comments

Comments

@TimNN
Copy link

TimNN commented Mar 22, 2024

The following code fails under Miri and with -Zsanitizer=address:

use rodeo::Rodeo;

struct Broken<'a>(Option<&'a String>);

impl<'a> core::ops::Drop for Broken<'a> {
    fn drop(&mut self) {
        println!("{:?}", self.0)
    }
}

fn main() {
    let r = Rodeo::new();
    let x = r.alloc(Broken(None));
    x.0 = Some(r.alloc(String::from("Hello, world!")));
}
@polazarus
Copy link
Owner

The problem is indeed critical. I will yank the current version and add 'static requirement on T for now.

polazarus added a commit that referenced this issue Mar 24, 2024
fixes Unsoundness / Use After Free if a custom Drop impl references other data allocated on the allocator. #1
polazarus added a commit that referenced this issue Mar 25, 2024
fixes Unsoundness / Use After Free if a custom Drop impl references other data allocated on the allocator. #1
polazarus added a commit that referenced this issue Mar 25, 2024
fixes Unsoundness / Use After Free if a custom Drop impl references other data allocated on the allocator. #1
@polazarus
Copy link
Owner

Done! Will need to revisit the whole self referential issue one day

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

2 participants