GHSA-3h87-v52r-p9rg

Suggest an improvement
Source
https://github.com/advisories/GHSA-3h87-v52r-p9rg
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/08/GHSA-3h87-v52r-p9rg/GHSA-3h87-v52r-p9rg.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-3h87-v52r-p9rg
Aliases
Published
2021-08-25T20:54:08Z
Modified
2023-11-08T04:05:44.188314Z
Severity
  • 7.3 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L CVSS Calculator
Summary
Out of bounds write in reorder
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 swapindex creates a vector containing uninitialized members. If the len() returned by the iterator is smaller than the actual number of members yielded, then swapindex 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.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-787"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2021-08-19T17:17:20Z"
}
References

Affected packages

crates.io / reorder

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.1.0