Skip to content

Fix double-free for ZSTs with Drop in .extend()#308

Merged
bluss merged 2 commits intobluss:masterfrom
Shnatsel:zst-extend-ub
May 3, 2026
Merged

Fix double-free for ZSTs with Drop in .extend()#308
bluss merged 2 commits intobluss:masterfrom
Shnatsel:zst-extend-ub

Conversation

@Shnatsel
Copy link
Copy Markdown
Contributor

@Shnatsel Shnatsel commented May 3, 2026

Zero-sized types that impl Drop get dropped twice in .extend(). This PR adds a test to demonstrate it, and fixes the issue.

This is a soundness bug, but likely not a big deal in practice, since this kind of type is really uncommon.

The issue was discovered by GPT-5.5 high

@bluss
Copy link
Copy Markdown
Owner

bluss commented May 3, 2026

Thanks for the perfect PR, that all looks valid.

I will have time to make a release next weekend

@bluss bluss merged commit 29daea9 into bluss:master May 3, 2026
7 checks passed
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