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

added NPE protection which occurred when reading corrupt PDFs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 0.8.0-incubator, 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.1, 1.4.0
    • 1.5.0
    • PDModel
    • None

    Description

      I came across a non-conforming PDF which resulted in a NPE when I tried to append a page to the document. The error was because there were no kids listed, so when rootPages.getKids().add(page); was called in addPage(PDPage page) it went into the COSArray.add() but threw an exception on line 180: array.add(((COSObjectable)o).getCOSObject()); I fixed this by checking to see if array was null before attempting to call the add() method.

      I can not attach the sample PDF because it contains confidential data.

      Despite the major non-conforming aspects of this PDF, Adobe reader is able to open it. This is one reason why I want to make sure PDFBox can at least process the file without throwing an exception.

      Attachments

        Activity

          People

            adamnichols Adam Nichols
            adamnichols Adam Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: