Medium severityOSV Advisory· Published Nov 26, 2025· Updated Apr 15, 2026
CVE-2025-66019
CVE-2025-66019
Description
pypdf is a free and open-source pure-python PDF library. Prior to version 6.4.0, an attacker who uses this vulnerability can craft a PDF which leads to a memory usage of up to 1 GB per stream. This requires parsing the content stream of a page using the LZWDecode filter. This issue has been patched in version 6.4.0.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
pypdfPyPI | < 6.4.0 | 6.4.0 |
Affected products
1Patches
13 files changed · +3 −3
pypdf/_codecs/_codecs.py+1 −1 modified@@ -50,7 +50,7 @@ class LzwCodec(Codec): INITIAL_BITS_PER_CODE = 9 # Initial code bit width MAX_BITS_PER_CODE = 12 # Maximum code bit width - def __init__(self, max_output_length: int = 1_000_000_000) -> None: + def __init__(self, max_output_length: int = 75_000_000) -> None: self.max_output_length = max_output_length def _initialize_encoding_table(self) -> None:
pypdf/filters.py+1 −1 modified@@ -71,7 +71,7 @@ ) ZLIB_MAX_OUTPUT_LENGTH = 75_000_000 -LZW_MAX_OUTPUT_LENGTH = 1_000_000_000 +LZW_MAX_OUTPUT_LENGTH = 75_000_000 def _decompress_with_limit(data: bytes) -> bytes:
tests/test_codecs.py+1 −1 modified@@ -92,6 +92,6 @@ def test_lzw_decoder__output_limit(): page = reader.pages[0] with pytest.raises( - expected_exception=LimitReachedError, match=r"^Limit reached while decompressing: 1000000170 > 1000000000$" + expected_exception=LimitReachedError, match=r"^Limit reached while decompressing: 75000828 > 75000000$" ): page.images[0].image.load()
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
8- github.com/advisories/GHSA-m449-cwjh-6pw7ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-66019ghsaADVISORY
- aydinnyunus.github.io/2025/12/20/cve-2025-66019-pypdf-lzw-dosghsaWEB
- github.com/py-pdf/pypdf/commit/96186725e5e6f237129a58a97cd19204a9ce40b2nvdWEB
- github.com/py-pdf/pypdf/releases/tag/6.4.0nvdWEB
- github.com/py-pdf/pypdf/security/advisories/GHSA-jfx9-29x2-rv3jghsaWEB
- github.com/py-pdf/pypdf/security/advisories/GHSA-m449-cwjh-6pw7nvdWEB
- aydinnyunus.github.io/2025/12/20/cve-2025-66019-pypdf-lzw-dos/nvd
News mentions
0No linked articles in our index yet.