Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. stackvector
  4. ›
  5. CVE-2021-29939

CVE-2021-29939: Out of bounds write in stackvector

August 25, 2021 (updated June 13, 2023)

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.

References

  • github.com/Alexhuszagh/rust-stackvector
  • github.com/Alexhuszagh/rust-stackvector/issues/2
  • github.com/advisories/GHSA-9frf-r7c7-j2vg
  • nvd.nist.gov/vuln/detail/CVE-2021-29939
  • rustsec.org/advisories/RUSTSEC-2021-0048.html

Code Behaviors & Features

Detect and mitigate CVE-2021-29939 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 1.0.9

Fixed versions

  • 1.0.9

Solution

Upgrade to version 1.0.9 or above.

Impact 7.3 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

Learn more about CVSS

Weakness

  • CWE-787: Out-of-bounds Write

Source file

cargo/stackvector/CVE-2021-29939.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:08 +0000.