HistoryEdit

RUSTSEC-2021-0033

push_cloned can drop uninitialized memory or double free on panic

Issued
Package
stack_dst (crates.io)
Type
Vulnerability
Categories
Keywords
#memory-safety #double-free
Aliases
Details
https://github.com/thepowersgang/stack_dst-rs/issues/5
CVSS Score
9.8 CRITICAL
CVSS Details
Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Patched
  • >=0.6.1
Keywords
#memory-safety #double-free
Affected Functions
Version
stack_dst::StackA::push_cloned
  • <0.6.1

Description

Affected versions of stack_dst used a push_inner function that increased the internal length of the array and then called val.clone().

If the val.clone() call panics, the stack could drop an already dropped element or drop uninitialized memory.

This issue was fixed in 2a4d538 by increasing the length of the array after elements are cloned.