pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1806068 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java test/java/org/apache/pdfbox/pdfparser/PDFStreamParserTest.java
Date Thu, 24 Aug 2017 17:54:59 GMT
Author: tilman
Date: Thu Aug 24 17:54:58 2017
New Revision: 1806068

URL: http://svn.apache.org/viewvc?rev=1806068&view=rev
Log:
PDFBOX-3909: there can be a hex 0 before the operator after the EI

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFStreamParserTest.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1806068&r1=1806067&r2=1806068&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java Thu
Aug 24 17:54:58 2017
@@ -381,19 +381,19 @@ public class PDFStreamParser extends Bas
             for (int bIdx = 0; bIdx < readBytes; bIdx++)
             {
                 final byte b = binCharTestArr[bIdx];
-                if (b < 0x09 || b > 0x0a && b < 0x20 && b != 0x0d)
+                if (b != 0 && b < 0x09 || b > 0x0a && b < 0x20 &&
b != 0x0d)
                 {
                     // control character or > 0x7f -> we have binary data
                     noBinData = false;
                     break;
                 }
                 // find the start of a PDF operator
-                if (startOpIdx == -1 && !(b == 9 || b == 0x20 || b == 0x0a || b ==
0x0d))
+                if (startOpIdx == -1 && !(b == 0 || b == 9 || b == 0x20 || b == 0x0a
|| b == 0x0d))
                 {
                     startOpIdx = bIdx;
                 }
                 else if (startOpIdx != -1 && endOpIdx == -1 &&
-                         (b == 9 || b == 0x20 || b == 0x0a || b == 0x0d))
+                         (b == 0 || b == 9 || b == 0x20 || b == 0x0a || b == 0x0d))
                 {
                     endOpIdx = bIdx;
                 }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFStreamParserTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFStreamParserTest.java?rev=1806068&r1=1806067&r2=1806068&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFStreamParserTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/PDFStreamParserTest.java
Thu Aug 24 17:54:58 2017
@@ -49,6 +49,8 @@ public class PDFStreamParserTest extends
         testInlineImage2ops("ID\n12345EI  Q ", "12345", "Q");
         testInlineImage2ops("ID\n12345EI  EMC ", "12345", "EMC");
 
+        testInlineImage2ops("ID\n12345EI \000Q", "12345", "Q");
+
         testInlineImage2ops("ID\n12345EI Q                             ", "12345", "Q");
         testInlineImage2ops("ID\n12345EI EMC                           ", "12345", "EMC");
 



Mime
View raw message