You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/10/17 19:56:02 UTC
svn commit: r1844157 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Author: tilman
Date: Wed Oct 17 19:56:02 2018
New Revision: 1844157
URL: http://svn.apache.org/viewvc?rev=1844157&view=rev
Log:
PDFBOX-4352: avoid NullPointerException
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1844157&r1=1844156&r2=1844157&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Wed Oct 17 19:56:02 2018
@@ -326,7 +326,7 @@ public class COSParser extends BaseParse
parseXrefTable(prev);
if (!parseTrailer())
{
- throw new IOException("Expected trailer object at position: "
+ throw new IOException("Expected trailer object at offset "
+ source.getPosition());
}
COSDictionary trailer = xrefTrailerResolver.getCurrentTrailer();
@@ -2497,7 +2497,7 @@ public class COSParser extends BaseParse
if (source.getPosition() == trailerOffset)
{
// warn only the first time
- LOG.warn("Expected trailer object at position " + trailerOffset
+ LOG.warn("Expected trailer object at offset " + trailerOffset
+ ", keep trying");
}
readLine();
@@ -2916,6 +2916,13 @@ public class COSParser extends BaseParse
private void parseDictionaryRecursive(COSObject dictionaryObject) throws IOException
{
parseObjectDynamically(dictionaryObject, true);
+ if (dictionaryObject.getObject() == null)
+ {
+ // we can't be lenient here, this is called by prepareDecryption()
+ // to get the encryption directory
+ throw new IOException("Dictionary object " + dictionaryObject +
+ " is null at offset " + source.getPosition());
+ }
COSDictionary dictionary = (COSDictionary) dictionaryObject.getObject();
for (COSBase value : dictionary.getValues())
{