Skip to content

Commit

Permalink
ROB: Allow extra whitespace before "obj" in readObjectHeader (#567)
Browse files Browse the repository at this point in the history
The header being read has the format:

    <idnum> <generation> obj

where `<idnum>` and `<generation>` are integers.
Previously an arbitrary number of spaces was being allowed between `<idnum>` and `<generation>`, but not between `<generation>` and `obj`.
We now allow arbitrary spaces between `<generation>` and `obj`.
  • Loading branch information
malthejorgensen authored Apr 16, 2022
1 parent a5875c5 commit cf20f92
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions PyPDF2/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,7 @@ def readObjectHeader(self, stream):
idnum = readUntilWhitespace(stream)
extra |= utils.skipOverWhitespace(stream); stream.seek(-1, 1)
generation = readUntilWhitespace(stream)
extra |= utils.skipOverWhitespace(stream); stream.seek(-1, 1)

# although it's not used, it might still be necessary to read
_obj = stream.read(3) # noqa: F841
Expand Down

0 comments on commit cf20f92

Please sign in to comment.