Description
pypdf is an open source, pure-python PDF library. In affected versions an attacker may craft a PDF which leads to an infinite loop if `__parse_content_stream` is executed. That is, for example, the case if the user extracted text from such a PDF. This issue was introduced in pull request #969 and resolved in pull request #1828. Users are advised to upgrade. Users unable to upgrade may modify the line `while peek not in (b"\r", b"\n")` in `pypdf/generic/_data_structures.py` to `while peek not in (b"\r", b"\n", b"")`.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| py-pdf | pypdf | pypdf: < 3.90, PyPDF2: >= 2.2.0 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | pypdf | 3.17.4-1 | — |
| Debian 13 | pypdf | 3.17.4-1 | — |
| Debian 12 | pypdf | 3.4.1-1+deb12u1 | — |
| Debian 12 | pypdf2 | 2.12.1-3+deb12u1 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | pypdf | No fix yet | — |
| Ubuntu 26.04 LTS | pypdf | No fix yet | — |
| Ubuntu 25.10 | pypdf | No fix yet | — |
| Ubuntu 24.04 LTS | pypdf | No fix yet | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | pypdf | >= 3.1.0, < 3.9.0 | 3.9.0 | GHSA-4vvm-4w3v-6mr8 |
| PyPI | pypdf2 | >= 2.2.0, <= 3.0.1 | — | GHSA-4vvm-4w3v-6mr8 |
| PyPI | pypdf2 | >= 2.2.0, < 3.9.0 | 3.9.0 | PYSEC-2026-1835 |