Skip to content

Infinite loop while reading metadata #1329

@MartinThoma

Description

@MartinThoma

When I try to read the metadata of Effective Java 3rd Edition by Joshua Bloch.pdf it takes extremely long. It might even be an infinite loop.

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-5.4.0-125-generic-x86_64-with-debian-bullseye-sid

$ python -c "import PyPDF2;print(PyPDF2.__version__)"
2.10.5

Code + PDF

This is a minimal, complete example that shows the issue:

from PyPDF2 import PdfReader

reader = PdfReader("Effective Java 3rd Edition by Joshua Bloch.pdf")
metadata = reader.metadata

The PDF: Effective Java 3rd Edition by Joshua Bloch.pdf

Affected

  • NOT: PyPDF2<=2.10.4 (throws an exception)
  • NOT PyPDF2>=2.10.6 (reads data properly)
  • IS AFFECTED: PyPDF2==2.10.5
  • See GHSA-hm9v-vj3r-r55m

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has MCVEA minimal, complete and verifiable example helps a lot to debug / understand feature requestshelp wantedWe appreciate help everywhere - this one might be an easy start!is-bugFrom a users perspective, this is a bug - a violation of the expected behavior with a compliant PDFnf-performanceNon-functional change: Performancenf-securityNon-functional change: Security

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions