Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ def _read_standard_xref_table(self, stream: StreamType) -> None:
)
generation = 65535
offset = -1
entry_type_b = b"f"
else:
logger_warning(
f"entry {num} in Xref table invalid but object found",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1863,3 +1863,14 @@ def test_read_pdf15_xref_stream():
match=r"^Trailer cannot be read: Limit reached while decompressing\. 1545392 bytes remaining\.$"
):
PdfReader(BytesIO(data_modified))


@pytest.mark.enable_socket
def test_read_standard_xref_table__two_whitespace_characters_between_offset_and_generation():
"""Tests for #3482"""
url = "https://github.com/user-attachments/files/22591813/helloworld.pdf"
name = "issue3482.pdf"

reader = PdfReader(BytesIO(get_data_from_url(url, name=name)))
assert len(reader.pages) == 1
assert reader.pages[0].extract_text() == "Hello World!"
2 changes: 1 addition & 1 deletion tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def test_image_extraction2(url, name):
"tika-918137.pdf",
),
(
"https://unglueit-files.s3.amazonaws.com/ebf/7552c42e9280b4476e59e77acc0bc812.pdf",
"https://github.com/user-attachments/files/22596566/7552c42e9280b4476e59e77acc0bc812.pdf",
"7552c42e9280b4476e59e77acc0bc812.pdf",
),
],
Expand Down
Loading