pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1624536 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParser.java
Date Fri, 12 Sep 2014 13:15:53 GMT
Author: tilman
Date: Fri Sep 12 13:15:53 2014
New Revision: 1624536

URL: http://svn.apache.org/r1624536
Log:
PDFBOX-2345: avoid exception if there are more objects than in /N value of /ObjStrm

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParser.java?rev=1624536&r1=1624535&r2=1624536&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParser.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFObjectStreamParser.java
Fri Sep 12 13:15:53 2014
@@ -61,9 +61,9 @@ public class PDFObjectStreamParser exten
             COSStream strm, COSDocument doc, boolean forceParsing)
             throws IOException 
     {
-       super(strm.getUnfilteredStream(), forceParsing);
-       setDocument( doc );
-       stream = strm;
+        super(strm.getUnfilteredStream(), forceParsing);
+        setDocument(doc);
+        stream = strm;
     }
 
     /**
@@ -107,6 +107,11 @@ public class PDFObjectStreamParser exten
             {
                 object = new COSObject(cosObject);
                 object.setGenerationNumber( COSInteger.ZERO );
+                if (objectCounter >= objectNumbers.size())
+                {
+                    LOG.error("/ObjStm (object stream) has more objects than /N " + numberOfObjects);
+                    break;
+                }
                 COSInteger objNum =
                     COSInteger.get( objectNumbers.get( objectCounter).intValue() );
                 object.setObjectNumber( objNum );



Mime
View raw message