Skip to content

Commit 9619441

Browse files
committed
BUG: Incorrectly issued xref warning/exception
Closes #852
1 parent def7a62 commit 9619441

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

PyPDF2/_reader.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,12 +932,14 @@ def read(self, stream):
932932

933933
# check and eventually correct the startxref only in not strict
934934
xref_issue_nr = self._get_xref_issues(stream, startxref)
935-
if self.strict and xref_issue_nr:
936-
raise PdfReadError("Broken xref table")
937-
else:
938-
warnings.warn(
939-
"incorrect startxref pointer({})".format(xref_issue_nr), PdfReadWarning
940-
)
935+
if xref_issue_nr != 0:
936+
if self.strict and xref_issue_nr:
937+
raise PdfReadError("Broken xref table")
938+
else:
939+
warnings.warn(
940+
"incorrect startxref pointer({})".format(xref_issue_nr),
941+
PdfReadWarning,
942+
)
941943

942944
# read all cross reference tables and their trailers
943945
self.xref = {}

0 commit comments

Comments
 (0)