Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. pyo3
  4. ›
  5. GHSA-pph8-gcv7-4qj5

GHSA-pph8-gcv7-4qj5: PyO3 Risk of buffer overflow in `PyString::from_object`

April 2, 2025 (updated October 31, 2025)

PyString::from_object took &str arguments and forwarded them directly to the Python C API without checking for terminating nul bytes. This could lead the Python interpreter to read beyond the end of the &str data and potentially leak contents of the out-of-bounds read (by raising a Python exception containing a copy of the data including the overflow).

In PyO3 0.24.1 this function will now allocate a CString to guarantee a terminating nul bytes. PyO3 0.25 will likely offer an alternative API which takes &CStr arguments.

References

  • github.com/PyO3/pyo3
  • github.com/PyO3/pyo3/issues/5005
  • github.com/PyO3/pyo3/pull/5008
  • github.com/advisories/GHSA-pph8-gcv7-4qj5
  • rustsec.org/advisories/RUSTSEC-2025-0020.html

Code Behaviors & Features

Detect and mitigate GHSA-pph8-gcv7-4qj5 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 0.1.0 before 0.24.1

Fixed versions

  • 0.24.1

Solution

Upgrade to version 0.24.1 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-125: Out-of-bounds Read

Source file

cargo/pyo3/GHSA-pph8-gcv7-4qj5.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:33 +0000.