---
id: CVE-2018-20991
aliases:
  - RUSTSEC-2018-0003
  - GHSA-rxr4-x558-x7hw
title: 'Possible double free during unwinding in SmallVec::insert_many'
summary: 'Possible double free during unwinding in SmallVec::insert_many'
severity: critical
cvss: 9.8
cvssVector: 'CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'
vendor: smallvec
product: smallvec
ecosystem: rust
affected:
  - 'smallvec >= 0.6.0-0, < 0.6.3'
patched:
  - smallvec 0.6.3
published: '2018-07-19'
updated: '2026-07-17'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/RUSTSEC-2018-0003'
references:
  - url: 'https://crates.io/crates/smallvec'
  - url: 'https://rustsec.org/advisories/RUSTSEC-2018-0003.html'
  - url: 'https://github.com/servo/rust-smallvec/issues/96'
tags:
  - osv
  - rust
epss: 0.01813
epssPercentile: 0.77737
ingestedAt: '2026-07-17T19:00:51.597Z'
---

## Overview

If an iterator passed to `SmallVec::insert_many` panicked in `Iterator::next`,
destructors were run during unwinding while the vector was in an inconsistent
state, possibly causing a double free (a destructor running on two copies of
the same value).

This is fixed in smallvec 0.6.3 by ensuring that the vector's length is not
updated to include moved items until they have been removed from their
original positions.  Items may now be leaked if `Iterator::next` panics, but
they will not be dropped more than once.

Thank you to [@Vurich](https://github.com/Vurich) for reporting this bug.

## Affected packages

- `smallvec >= 0.6.0-0, < 0.6.3`

## Remediation

Upgrade to a patched release:

- `smallvec 0.6.3`
