Skip to content

Commit

Permalink
BUG: Incorrectly issued xref warning/exception (#855)
Browse files Browse the repository at this point in the history
Closes #852
  • Loading branch information
MartinThoma authored May 2, 2022
1 parent def7a62 commit c96489d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions PyPDF2/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,14 @@ def read(self, stream):

# check and eventually correct the startxref only in not strict
xref_issue_nr = self._get_xref_issues(stream, startxref)
if self.strict and xref_issue_nr:
raise PdfReadError("Broken xref table")
else:
warnings.warn(
"incorrect startxref pointer({})".format(xref_issue_nr), PdfReadWarning
)
if xref_issue_nr != 0:
if self.strict and xref_issue_nr:
raise PdfReadError("Broken xref table")
else:
warnings.warn(
"incorrect startxref pointer({})".format(xref_issue_nr),
PdfReadWarning,
)

# read all cross reference tables and their trailers
self.xref = {}
Expand Down

0 comments on commit c96489d

Please sign in to comment.