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

Soundness issue of map_ref_mut #3

Closed
QuarticCat opened this issue Jul 6, 2023 · 0 comments
Closed

Soundness issue of map_ref_mut #3

QuarticCat opened this issue Jul 6, 2023 · 0 comments

Comments

@QuarticCat
Copy link
Owner

Consider foo.map_ref_mut(|f| *f = new_f), it will drop the old f. If the old f contains a Box, it will cause a double-free issue. Even f is trivially droppable, the modification won't be applied to foo, the compact f. We need to find a way to prevent users from modifying f itself or mark this function as unsafe or invent a new API to replace it.

QuarticCat added a commit that referenced this issue Jul 6, 2023
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

1 participant