Merge pull request #255 from christianlouis/copilot/mitigate-pypdf-infinite-loop

fix(deps): mitigate PyPDF2 infinite loop vulnerability (CVE-2023-36464)
This commit is contained in:
Christian Krakau-Louis
2026-02-12 03:58:36 +01:00
committed by GitHub
20 changed files with 85 additions and 46 deletions
+4 -4
View File
@@ -778,7 +778,7 @@ class TestPdfGenerator:
@staticmethod
def test_generate_default_pdf() -> None:
"""Test that generate_test_pdf creates a valid PDF with embedded text."""
import PyPDF2
import pypdf # Upgraded from PyPDF2 to fix CVE-2023-36464
path = generate_test_pdf()
try:
@@ -786,7 +786,7 @@ class TestPdfGenerator:
assert os.path.getsize(path) > 100
with open(path, "rb") as f:
reader = PyPDF2.PdfReader(f)
reader = pypdf.PdfReader(f)
assert len(reader.pages) >= 1
text = reader.pages[0].extract_text()
assert "Invoice" in text
@@ -797,13 +797,13 @@ class TestPdfGenerator:
@staticmethod
def test_generate_custom_content_pdf() -> None:
"""Test that generate_test_pdf accepts custom content."""
import PyPDF2
import pypdf # Upgraded from PyPDF2 to fix CVE-2023-36464
custom = "Custom test content for verification"
path = generate_test_pdf(content=custom)
try:
with open(path, "rb") as f:
reader = PyPDF2.PdfReader(f)
reader = pypdf.PdfReader(f)
text = reader.pages[0].extract_text()
assert "Custom test content" in text
finally:
+1 -1
View File
@@ -12,7 +12,7 @@ import os
import tempfile
import pytest
from PyPDF2 import PdfReader, PdfWriter
from pypdf import PdfReader, PdfWriter # Upgraded from PyPDF2 to fix CVE-2023-36464
from app.utils.file_splitting import should_split_file, split_pdf_by_size