pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1536441 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser: BaseParser.java PDFParser.java
Date Mon, 28 Oct 2013 17:46:31 GMT
Author: lehmi
Date: Mon Oct 28 17:46:30 2013
New Revision: 1536441

URL: http://svn.apache.org/r1536441
Log:
PDFBOX-1607: use the correct length to avoid StringIndexOutOfBoundsException as proposed by
Arjohn Kampman

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1536441&r1=1536440&r2=1536441&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Mon Oct
28 17:46:30 2013
@@ -996,10 +996,11 @@ public abstract class BaseParser
             }
             else
             {
-                // if invalid chars was found
+                // if invalid chars was found: discard last
+                // hex character if it is not part of a pair
                 if (sBuf.length()%2!=0)
                 {
-                    sBuf.deleteCharAt(strmBuf.length-1);
+                    sBuf.deleteCharAt(sBuf.length()-1);
                 }
                 
                 // read till the closing bracket was found

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1536441&r1=1536440&r2=1536441&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Mon Oct 28
17:46:30 2013
@@ -186,7 +186,8 @@ public class PDFParser extends BaseParse
                                 
                 try
                 {
-                    wasLastParsedObjectEOF = parseObject();
+                    // don't reset flag to false if it is already true
+                    wasLastParsedObjectEOF |= parseObject();
                 }
                 catch(IOException e)
                 {



Mime
View raw message