added NPE protection which occurred when reading corrupt PDFs
-------------------------------------------------------------
Key: PDFBOX-928
URL: https://issues.apache.org/jira/browse/PDFBOX-928
Project: PDFBox
Issue Type: Improvement
Components: PDModel
Affects Versions: 1.4.0, 1.3.1, 1.2.1, 1.2.0, 1.1.0, 1.0.0, 0.8.0-incubator
Reporter: Adam Nichols
Assignee: Adam Nichols
Priority: Trivial
Fix For: 1.5.0
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.