OSV 1.4.0 · github-reviewed · 修改于 2023-06-14 04:49
发布时间
2021-08-26 04:54
GitHub 审查时间
2021-08-20 01:17
NVD 发布时间
—
源文件
advisories/github-reviewed/2021/08/GHSA-jpwg-6gf5-5vh9/GHSA-jpwg-6gf5-5vh9.json
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.