Advisory

RUSTSEC-2018-0003

Also known as: CVE-2018-20991, GHSA-rxr4-x558-x7hw

Summary

Possible double free during unwinding in SmallVec::insert_many

Details

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 for reporting this bug.

Severity

Critical Basis: CVSS v3 score 9.8, vector CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Dates

Published
2018-07-19 12:00 UTC
Modified
2026-07-17 16:00 UTC

Affected packages and fixes

smallvec

crates.io · All systems

Affected

  • introduced 0.3.2, fixed 0.3.4, introduced 0.4.0-0, fixed 0.4.5, introduced 0.5.0-0, fixed 0.5.1, introduced 0.6.0-0, fixed 0.6.3 (semver)

Fixed versions

0.3.4, 0.4.5, 0.5.1, 0.6.3

Fix

  • Fixed version 0.3.4
    cargo update -p smallvec --precise 0.3.4
  • Fixed version 0.4.5
    cargo update -p smallvec --precise 0.4.5
  • Fixed version 0.5.1
    cargo update -p smallvec --precise 0.5.1
  • Fixed version 0.6.3
    cargo update -p smallvec --precise 0.6.3

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences