Skip to content
OpenAdvisories
Medium · 6.2 CVE-2023-36464 EUVD-2023-1690GHSA-4vvm-4w3v-6mr8PYSEC-2026-1835PYSEC-2026-3008

Infinite Loop when a comment isn't followed by a character in pypdf

Published Jun 27, 2023 · Updated Dec 3, 2024 · Assigned by GitHub_M

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

VendorProductAffectedFixed
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.

ReleasePackageFixed inAdvisory
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 —
ReleasePackageFixed inAdvisory
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

EcosystemPackageAffectedFixedRecord
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

References