Fix a bug in _readInlineImage. We were looking for the operation EI and Q, but were not checking to ensure that there was whitespace between EI and Q. Accordingly, any image that had EIQ in its ascii encoded data would trigger the end of the image, and cause errors.

This commit is contained in:
speedplane 2016-05-03 16:18:50 -04:00
parent 077782dbbb
commit 9dadb45f00
1 changed files with 5 additions and 2 deletions

View File

@ -2731,13 +2731,16 @@ class ContentStream(DecodedStreamObject):
# Check for End Image
tok2 = stream.read(1)
if tok2 == b_("I"):
# Sometimes that data will contain EI, so check for the Q operator.
# Data can contain EI, so check for the Q operator.
tok3 = stream.read(1)
info = tok + tok2
# We need to find whitespace between EI and Q.
has_q_whitespace = False
while tok3 in utils.WHITESPACES:
has_q_whitespace = True
info += tok3
tok3 = stream.read(1)
if tok3 == b_("Q"):
if tok3 == b_("Q") and has_q_whitespace:
stream.seek(-1, 1)
break
else: