Skip to content

Commit

Permalink
Use a warnings instead of raising exception
Browse files Browse the repository at this point in the history
where zlib error is detected before the CRC checksum.
  • Loading branch information
Sylvain Thénault committed Sep 29, 2021
1 parent c92e3a9 commit 8c3a4fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pdfminer/pdftypes.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import zlib
import warnings
import logging
import io
from .lzw import lzwdecode
from .ascii85 import ascii85decode
from .ascii85 import asciihexdecode
from .runlength import rldecode
from .ccitt import ccittfaxdecode
from .pdfdocument import PDFEncryptionError
from .psparser import PSException
from .psparser import PSObject
from .psparser import LIT
Expand Down Expand Up @@ -203,7 +205,7 @@ def decompress_corrupted(data):
except zlib.error:
# Let the error propagates if we're not yet in the CRC checksum
if i < len(data) - 3:
raise
warnings.warn("Data-loss while decompressing corrupted data", PDFEncryptionError)
return result_str


Expand Down

0 comments on commit 8c3a4fc

Please sign in to comment.