Skip to content

Fix element ownership tracking with may_dangle - #594

Open
charliermarsh wants to merge 1 commit into
servo:v1from
astral-sh:charlie/codex-fix-may-dangle
Open

Fix element ownership tracking with may_dangle#594
charliermarsh wants to merge 1 commit into
servo:v1from
astral-sh:charlie/codex-fix-may-dangle

Conversation

@charliermarsh

Copy link
Copy Markdown
Contributor

With may_dangle enabled, we currently allow references read by an element's destructor to expire before the vector is dropped, causing a use-after-free.

Track ownership of A::Item with PhantomData so drop checking rejects this, including spilled vectors with zero inline capacity. Plain borrowed references without destructors retain the intended may_dangle behavior.

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

this and #596 won't make it to v1.16.1, but we can make a second patch later

@charliermarsh

Copy link
Copy Markdown
Contributor Author

Cool, thanks for the heads up

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

Successfully merging this pull request may close these issues.

2 participants