Skip to main content

Loop with Unreachable Exit Condition ('Infinite Loop')

CVE-2023-36464

Severity Medium
Score 5.5/10

Summary

pypdf is an open-source, pure-python PDF library. In PyPDF2 package versions 2.2.1 through 3.0.1 and pypdf package versions 3.1.0 through 3.8.1, an attacker may craft a PDF which leads to an infinite loop if "__parse_content_stream" is executed. That is, for example, the case if the user extracted text from such a PDF. This issue was introduced in pull request #969 and resolved in pull request #1828. Users are advised to upgrade. Users unable to upgrade may modify the line `while peek not in (b"\r", b"\n")` in `pypdf/generic/_data_structures.py` to `while peek not in (b"\r", b"\n", b"")`.

  • LOW
  • LOCAL
  • NONE
  • UNCHANGED
  • REQUIRED
  • NONE
  • NONE
  • HIGH

CWE-835 - Loop with Unreachable Exit Condition

Loops with multiple exits and flags detract from the quality of an application. They tend to make control structures difficult to understand, and introduce the risk of non-termination and other structural problems. The vulnerability “loop with unreachable exit condition” enables attackers to exploit this flaw, leading to denial of service.

Advisory Timeline

  • Published