GitHub Advisoryadvisory · crates.io

GHSA-3h87-v52r-p9rg Out of bounds write in reorder

HIGH Published 2021-08-25 Modified 2023-06-13 Official page ↗
Aliases
CVE-2021-29941
Ecosystem
crates.io
Packages
reorder
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Weaknesses
CWE-787
Reviewed
2021-08-19

Affected packages

• crates.io reorder: < 1.1.0 → fixed in 1.1.0

Description

swap_index takes an iterator and swaps the items with their corresponding indexes. It reserves capacity and sets the length of the vector based on the .len() method of the iterator. If the len() returned by the iterator is larger than the actual number of elements yielded, then swap_index creates a vector containing uninitialized members. If the len() returned by the iterator is smaller than the actual number of members yielded, then swap_index can write out of bounds past its allocated vector. As noted by the Rust documentation, len() and size_hint() are primarily meant for optimization and incorrect values from their implementations should not lead to memory safety violations.

Related

Alias · CVE (1)

  • CVE-2021-29941 An issue was discovered in the reorder crate through 2021-02-24 for Rust. vulnerability

Weakness · CWE (1)

  • CWE-787 Out-of-bounds Write weakness

References