avoid endless loop with some corrupt pdfs

This commit is contained in:
j 2016-02-27 12:12:31 +05:30
parent bcd7a02667
commit f07dfdf916
1 changed files with 2 additions and 0 deletions

View File

@ -1911,6 +1911,8 @@ class PdfFileReader(object):
if stream.tell() < 2:
raise utils.PdfReadError("EOL marker not found")
step = min(stream.tell()-2, 8*1024)
if step < 2:
raise utils.PdfReadError("EOL marker not found")
stream.seek(-step, 1)
x = stream.read(step)
if b_('\n') in x or b_('\r') in x: