Skip to content

Commit 1de7f94

Browse files
handle edge case
1 parent 54ae0a6 commit 1de7f94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pypdf/generic/_data_structures.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,12 @@ def _read_inline_image(self, stream: StreamType) -> Dict[str, Any]:
10681068
# We have reached the end of the stream, but haven't found the EI operator.
10691069
if not buf:
10701070
raise PdfReadError("Unexpected end of stream")
1071+
if len(buf) == 2 and buf == b'EI':
1072+
break
10711073
loc = buf.find(
10721074
b"E"
10731075
) # we can not look straight for "EI" because it may not have been loaded in the buffer
1074-
1076+
10751077
if loc == -1:
10761078
data.write(buf)
10771079
else:

0 commit comments

Comments
 (0)