Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. partial_sort
  4. ›
  5. GHSA-5x36-7567-3cw6

GHSA-5x36-7567-3cw6: partial_sort contains Out-of-bounds Read in release mode

February 28, 2023

Affected versions of this crate were using a debug assertion to validate the last parameter of partial_sort(). This would allow invalid inputs to cause an out-of-bounds read instead of immediately panicking, when compiled without debug assertions.

All writes are bounds-checked, so the out-of-bounds memory access is read-only. This also means that the first attempted out-of-bounds write will panic, limiting the possible reads.

The accessible region is further limited by an initial bounds-checked read at (last / 2) - 1, i.e., it is proportional to the size of the vector.

This bug has been fixed in v0.2.0.

References

  • github.com/advisories/GHSA-5x36-7567-3cw6
  • github.com/sundy-li/partial_sort
  • github.com/sundy-li/partial_sort/issues/7
  • rustsec.org/advisories/RUSTSEC-2023-0016.html

Code Behaviors & Features

Detect and mitigate GHSA-5x36-7567-3cw6 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 0.2.0

Fixed versions

  • 0.2.0

Solution

Upgrade to version 0.2.0 or above.

Weakness

  • CWE-125: Out-of-bounds Read

Source file

cargo/partial_sort/GHSA-5x36-7567-3cw6.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:02 +0000.