Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5401

A carefully crafted pdf can trigger an infinite loop while parsing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0 PDFBox
    • 2.0.26, 3.0.0 PDFBox
    • Parsing, PDModel
    • None
    • Mac OS 12.1 & Ubuntu Linux 16.04 (4.15.0-163-generic)

    Description

      Hi, I found a crafted pdf that can trigger an infinite loop while parsing using PDFBOX. I have tested on the latest commit of PDFBOX on Github.

       

      This bug can be triggered by the following code.

      ```

      File ff = new File("path/to/the/sample");

      PDDocument document = Loader.loadPDF(ff);

      ```

       

      I found that the root cause of this infinite loop resides in the while-loop at line 321 of  COSParse.java.]. When parsing the provided PDF files, the variable $prev is never changed during this loop.

      Attachments

        1. verified.zip
          2 kB
          Xiaohan Zhang

        Activity

          People

            lehmi Andreas Lehmkühler
            Han0nly Xiaohan Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: