Closed
Description
rust/library/alloc/src/vec/mod.rs
Lines 1608 to 1637 in d8af907
gap.read
is not updated (line 1636) when drop_in_place
(line 1623) panics. This lets FillGapOnDrop
's Drop
implementation to retain the already dropped element.
The bug was introduced in #82191 and affects stable Rust versions >= 1.52. Here is the playground link that demonstrates the double free without using unsafe Rust code.
Meta
rustc --version --verbose
:
rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0
Metadata
Metadata
Assignees
Labels
Area: `std::collections`Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessCritical priorityRelevant to the library team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.