Advisory

RUSTSEC-2021-0048

Also known as: CVE-2021-29939, GHSA-9frf-r7c7-j2vg

Summary

StackVec::extend can write out of bounds when size_hint is incorrect

Details

StackVec::extend used the lower and upper bounds from an Iterator's
size_hint to determine how many items to push into the stack based vector.

If the size_hint implementation returned a lower bound that was larger than
the upper bound, StackVec would write out of bounds and overwrite memory
on the stack. As mentioned by the size_hint
documentation, size_hint is mainly for optimization and incorrect
implementations should not lead to memory safety issues.

Severity

High Basis: CVSS v3 score 7.3, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

Dates

Published
2021-02-19 12:00 UTC
Modified
2023-11-08 04:05 UTC

Affected packages and fixes

stackvector

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 1.0.9 (semver)

Fixed versions

1.0.9

Fix

  • Fixed version 1.0.9
    cargo update -p stackvector --precise 1.0.9

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