avoid endless loop with some corrupt pdfs
This commit is contained in:
parent
bcd7a02667
commit
f07dfdf916
1 changed files with 2 additions and 0 deletions
|
@ -1911,6 +1911,8 @@ class PdfFileReader(object):
|
||||||
if stream.tell() < 2:
|
if stream.tell() < 2:
|
||||||
raise utils.PdfReadError("EOL marker not found")
|
raise utils.PdfReadError("EOL marker not found")
|
||||||
step = min(stream.tell()-2, 8*1024)
|
step = min(stream.tell()-2, 8*1024)
|
||||||
|
if step < 2:
|
||||||
|
raise utils.PdfReadError("EOL marker not found")
|
||||||
stream.seek(-step, 1)
|
stream.seek(-step, 1)
|
||||||
x = stream.read(step)
|
x = stream.read(step)
|
||||||
if b_('\n') in x or b_('\r') in x:
|
if b_('\n') in x or b_('\r') in x:
|
||||||
|
|
Loading…
Reference in a new issue