Skip to content

Commit

Permalink
Fix out-of-bound access on some PDFs.
Browse files Browse the repository at this point in the history
Replace the non-emptiness check with a minimum length check — you can't get the second to last item in a list of less than two items.
  • Loading branch information
Flameeyes committed Aug 31, 2020
1 parent 0b44f77 commit e86d1ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pdfminer/pdfdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def _getobj_parse(self, pos, objid):
while kwd is not self.KEYWORD_OBJ:
(_, kwd) = self._parser.nexttoken()
x.append(kwd)
if x:
if len(x) >= 2:
objid1 = x[-2]
# #### end hack around malformed pdf files
if objid1 != objid:
Expand Down

0 comments on commit e86d1ff

Please sign in to comment.