RUSTSEC-2021-0050

    Dashboard / Vulnerabilities / RUSTSEC-2021-0050

    RUSTSEC-2021-0050

    Published: 24 Feb 2021Last Modified: 8 Nov 2023

    Summary: swap_index can write out of bounds and return uninitialized memory

    Details: `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()`](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html#method.len) and `size_hint()` are primarily meant for optimization and incorrect values from their implementations should not lead to memory safety violations. # Patch A new version crate was pushed that marks this function as unsafe. reorder = "1.1.0" Previous versions have also been yanked from crates.io.

    Affected packages

    Package

    Name: reorder

    Purl: pkg:cargo/reorder

    Affected ranges

    Type: SEMVER

    Events:

    Introduced- 0.0.0-0
    Fixed -1.1.0

    Affected versions

    Common Vulnerability Scoring System

    Attack Vector
    Network
    Adjacent
    Local
    Physical
    Privileges Required
    None
    Low
    High
    User Interaction
    None
    Required
    Scope
    Unchanged
    Changed
    Confidentiality
    None
    Low
    High
    Integrity
    None
    Low
    High
    Availability
    None
    Low
    High
    RUSTSEC-2021-0050 | CVE-DB