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

PackageAffected versionsPatched versions
pypdfPyPI
< 6.4.06.4.0

Affected products

1

Patches

1
96186725e5e6

Merge commit from fork

https://github.com/py-pdf/pypdfStefanNov 23, 2025via ghsa
3 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

News mentions

0

No linked articles in our index yet.