mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 00:04:09 +03:00
Set stream length for later use
This commit is contained in:
parent
7d81cbd0ed
commit
ed0867abec
|
@ -823,12 +823,10 @@ class PdfParser:
|
|||
m = cls.re_stream_start.match(data, offset)
|
||||
if m:
|
||||
try:
|
||||
stream_len = int(result[b"Length"])
|
||||
except (TypeError, KeyError, ValueError) as e:
|
||||
msg = (
|
||||
"bad or missing Length in stream dict "
|
||||
f"({result.get(b'Length')})"
|
||||
)
|
||||
stream_len_str = result.get(b"Length")
|
||||
stream_len = int(stream_len_str)
|
||||
except (TypeError, ValueError) as e:
|
||||
msg = f"bad or missing Length in stream dict ({stream_len_str})"
|
||||
raise PdfFormatError(msg) from e
|
||||
stream_data = data[m.end() : m.end() + stream_len]
|
||||
m = cls.re_stream_end.match(data, m.end() + stream_len)
|
||||
|
|
Loading…
Reference in New Issue
Block a user