Skip to content

from_elem is unsound when clone can panic #101

@mbrubeck

Description

@mbrubeck

If clone panics during SmallVec::from_elem then uninitialized memory is dropped. [Original report by dbaupp on Reddit.]

This bug was introduced by #93 which is not yet included in the latest published release (0.6.2).

The suggested solution is to use something like SetLenOnDrop to make sure the length is set correctly when destructors run, without inhibiting optimizations.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions