Skip to content

Commit

Permalink
Merge branch 'main' into glyphlist
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Jun 6, 2022
2 parents dd22e9a + 81a9987 commit d58e601
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions PyPDF2/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,8 @@ def _get_object_from_stream(
if self.strict and idx != i:
raise PdfReadError("Object is in wrong index.")
stream_data.seek(int(obj_stm["/First"] + offset), 0) # type: ignore
read_non_whitespace(stream_data) # to cope with some case where the 'pointer' is on a white space
stream_data.seek(-1, 1)
try:
obj = read_object(stream_data, self)
except PdfStreamError as exc:
Expand Down
14 changes: 14 additions & 0 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import time
from io import BytesIO
import urllib.request

import pytest

Expand Down Expand Up @@ -666,3 +667,16 @@ def test_convertToInt_deprecated():
match=msg,
):
assert convertToInt(b"\x01", 8) == 1


def test_iss925():
reader = PdfReader(BytesIO(urllib.request.urlopen(
"https://github.com/py-pdf/PyPDF2/files/8796328/1.pdf").read()))

for page_sliced in reader.pages:
page_object = page_sliced.get_object()
# Extracts the PDF's Annots (Annotations and Commenting):
annots = page_object.get("/Annots")
if annots is not None:
for annot in annots:
annot.get_object()

0 comments on commit d58e601

Please sign in to comment.