diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index 02804fba1..6deda0ed1 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -958,6 +958,9 @@ def read(self, stream): if debug: print ">>read", stream # start at the end: stream.seek(-1, 2) + if not stream.tell(): + raise utils.PdfReadError, "File is empty" + line = b_('') if debug: print " line:",line while not line: