Infinite Loop when a comment isn't followed by a character in pypdf
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"")`.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2023-36464
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 01:32 UTC · Revision 1
Source evidence
Infinite Loop when a comment isn't followed by a character in pypdf
core-osv · Original sourcePublished 27 Jun 2023, 21:24 UTC
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"")`.
osv:CVE-2023-36464
Complete source record
{
"id": "1ab927dc43bcc9db06a5f9be3583ca93ad1967f3ebd545b184f011d13ee13055",
"url": "https://osv.dev/vulnerability/CVE-2023-36464",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Infinite Loop when a comment isn't followed by a character in pypdf",
"summary": "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\"\")`.",
"evidence": "osv:CVE-2023-36464",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2023-36464",
"aliases": [
"CVE-2023-36464",
"GHSA-4vvm-4w3v-6mr8",
"PYSEC-2026-1835",
"PYSEC-2026-3008"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/py-pdf/pypdf",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "0096c99031955b15bd30834e5566076d9528f59d"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:pypdf_project:pypdf:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "3.9.0"
}
],
"source": "CPE_RANGE"
}
]
}
}
],
"versions": [
"3.8.1",
"3.8.0",
"3.7.1",
"3.7.0",
"3.6.0",
"3.5.2",
"3.5.1",
"3.5.0",
"3.4.1",
"3.4.0",
"3.3.0",
"3.2.1",
"3.2.0",
"3.0.0",
"3.1.0",
"2.12.1",
"2.12.0",
"2.11.2",
"2.11.1",
"2.11.0",
"2.10.9",
"2.10.8",
"2.10.7",
"2.10.6",
"2.10.5",
"2.10.4",
"2.10.3",
"2.10.2",
"2.10.1",
"2.10.0",
"2.9.0",
"2.8.1",
"2.8.0",
"2.7.0",
"2.6.0",
"2.5.0",
"2.4.2",
"2.4.1",
"2.4.0",
"2.3.1",
"2.3.0",
"2.2.1",
"2.2.0",
"2.1.1",
"2.1.0",
"2.0.0",
"1.28.2",
"1.28.1",
"1.28.0",
"1.27.12",
"1.27.11",
"1.27.10",
"1.27.9",
"1.27.8",
"1.27.7",
"1.27.6",
"1.27.5",
"1.27.4",
"1.27.3",
"1.27.2",
"1.27.1",
"1.27.0",
"v1.24",
"1.26.0",
"v1.25.1",
"v1.25",
"v1.23",
"v1.22",
"v1.21",
"v1.20",
"v1.19",
"v1.18",
"v1.17"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-36464.json"
}
}
],
"modified": "2026-10-28T02:30:24.995829930Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/36xxx/CVE-2023-36464.json",
"https://github.com/py-pdf/pypdf/security/advisories/GHSA-4vvm-4w3v-6mr8",
"https://nvd.nist.gov/vuln/detail/CVE-2023-36464",
"https://github.com/py-pdf/pypdf/pull/1828",
"https://github.com/py-pdf/pypdf/pull/969"
],
"provider_metadata": {
"cwe_ids": [
"CWE-835"
],
"cna_assigner": "GitHub_M",
"unresolved_ranges": [
{
"extracted_events": [
{
"range": [
{
"introduced": " pypdf: < 3.90"
},
{
"last_affected": " pypdf: < 3.90"
},
{
"introduced": "PyPDF2: >= 2.2.0"
},
{
"last_affected": "PyPDF2: >= 2.2.0"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StandaloneSingleVersion"
}
]
}
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/36xxx/CVE-2023-36464.json"
}
},
"related_cves": [
{
"value": "CVE-2023-36464",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 491653,
"published_at": "2023-06-27T21:24:30.685+00:00"
}