VYPR
Critical severityNVD Advisory· Published Aug 26, 2019· Updated Aug 5, 2024

CVE-2018-20991

CVE-2018-20991

Description

An issue was discovered in the smallvec crate before 0.6.3 for Rust. The Iterator implementation mishandles destructors, leading to a double free.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

In smallvec crate before 0.6.3, the `SmallVec::insert_many` method mishandles destructors, causing a double free during unwinding.

Vulnerability

Description

The smallvec crate for Rust provides a "small vector" optimization that stores a small number of items on the stack before spilling to the heap. In versions before 0.6.3, the SmallVec::insert_many method contains a flaw in its Iterator implementation that mishandles destructors, leading to a double free [1][2]. The root cause is that the method does not properly update the vector length before iterating over the inserted elements, so if a panic occurs during iteration, the drop implementation may run on already-freed memory [2][4].

Exploitation

Prerequisites

An attacker can exploit this vulnerability without authentication or user interaction, as the CVSS vector (AV:N/AC:L/PR:N/UI:N) indicates network-based exploitation with low complexity [2]. The bug is triggered when insert_many is called with an iterator that panics during insertion, causing Rust's unwinding mechanism to invoke destructors on invalid state. This requires a crafted input that causes the panic, but no special privileges are needed.

Impact

Successful exploitation results in a double free, leading to memory corruption. The CVSS score of 9.8 (Critical) reflects high impacts on confidentiality, integrity, and availability [2]. An attacker could potentially corrupt heap or stack data, leading to arbitrary code execution or denial of service.

Mitigation

Status

The vulnerability is fixed in smallvec versions 0.6.3, 0.3.4, 0.4.5, and 0.5.1 [2]. Users should update to these patched versions immediately. The advisory notes that versions prior to 0.3.2 are unaffected because they do not include the vulnerable insert_many method [2].

AI Insight generated on May 22, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
smallveccrates.io
>= 0.3.2, < 0.6.30.6.3

Affected products

3

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

4

News mentions

0

No linked articles in our index yet.