Skip to content

Commit 9618672

Browse files
Merge commit from fork
1 parent 41e2e55 commit 9618672

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pypdf/_codecs/_codecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class LzwCodec(Codec):
5050
INITIAL_BITS_PER_CODE = 9 # Initial code bit width
5151
MAX_BITS_PER_CODE = 12 # Maximum code bit width
5252

53-
def __init__(self, max_output_length: int = 1_000_000_000) -> None:
53+
def __init__(self, max_output_length: int = 75_000_000) -> None:
5454
self.max_output_length = max_output_length
5555

5656
def _initialize_encoding_table(self) -> None:

pypdf/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
)
7272

7373
ZLIB_MAX_OUTPUT_LENGTH = 75_000_000
74-
LZW_MAX_OUTPUT_LENGTH = 1_000_000_000
74+
LZW_MAX_OUTPUT_LENGTH = 75_000_000
7575

7676

7777
def _decompress_with_limit(data: bytes) -> bytes:

tests/test_codecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ def test_lzw_decoder__output_limit():
9292
page = reader.pages[0]
9393

9494
with pytest.raises(
95-
expected_exception=LimitReachedError, match=r"^Limit reached while decompressing: 1000000170 > 1000000000$"
95+
expected_exception=LimitReachedError, match=r"^Limit reached while decompressing: 75000828 > 75000000$"
9696
):
9797
page.images[0].image.load()

0 commit comments

Comments
 (0)