diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index 357c9ae46..53ea01bd5 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -1820,12 +1820,12 @@ def read(self, stream): stream.seek(-1, 2) if not stream.tell(): raise PdfReadError('Cannot read an empty file') - last1K = stream.tell() - 1024 + 1 # offset of last 1024 bytes of stream + last1M = stream.tell() - 1024 * 1024 + 1 # offset of last MB of stream line = b_('') while line[:5] != b_("%%EOF"): - if stream.tell() < last1K: + if stream.tell() < last1M: raise PdfReadError("EOF marker not found") - line = self.readNextEndLine(stream, last1K) + line = self.readNextEndLine(stream) if debug: print(" line:",line) # find startxref entry - the location of the xref table