mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-09 08:00:49 +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)
|
m = cls.re_stream_start.match(data, offset)
|
||||||
if m:
|
if m:
|
||||||
try:
|
try:
|
||||||
stream_len = int(result[b"Length"])
|
stream_len_str = result.get(b"Length")
|
||||||
except (TypeError, KeyError, ValueError) as e:
|
stream_len = int(stream_len_str)
|
||||||
msg = (
|
except (TypeError, ValueError) as e:
|
||||||
"bad or missing Length in stream dict "
|
msg = f"bad or missing Length in stream dict ({stream_len_str})"
|
||||||
f"({result.get(b'Length')})"
|
|
||||||
)
|
|
||||||
raise PdfFormatError(msg) from e
|
raise PdfFormatError(msg) from e
|
||||||
stream_data = data[m.end() : m.end() + stream_len]
|
stream_data = data[m.end() : m.end() + stream_len]
|
||||||
m = cls.re_stream_end.match(data, m.end() + stream_len)
|
m = cls.re_stream_end.match(data, m.end() + stream_len)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user