pypdf
pypdf copied to clipboard
Infinite loop with PDFFileReader when file is empty
Reproducible with:
import StringIO, PyPDF2
PyPDF2.PdfFileReader(StringIO.StringIO())
The infinite loop bug occurs in the ReadNextEndLine() method. We'll include a fix in the next patch - would it be acceptable to just throw an exception?
Added the fix for infinite loop caused by empty file just now - however I recently noticed that a StringIO object with random characters with cause an infinite loop as well instead of throwing an exception. We should be able to fix this easily.
This was solved pre 1.20, so I'll ignore it. I hope nobody still uses such an old version