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 2017/04/02 09:43:06 UTC

svn commit: r1789870 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java

Author: tilman
Date: Sun Apr  2 09:43:06 2017
New Revision: 1789870

URL: http://svn.apache.org/viewvc?rev=1789870&view=rev
Log:
PDFBOX-3742: assume that valid non-blank sequence after EI is Q or EMC

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1789870&r1=1789869&r2=1789870&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java Sun Apr  2 09:43:06 2017
@@ -483,6 +483,18 @@ public class PDFStreamParser extends Bas
                     endOpIdx = bIdx;
                 }
             }
+
+            // PDFBOX-3742: just assuming that 1-3 non blanks is a PDF operator isn't enough
+            if (endOpIdx != -1 && startOpIdx != -1)
+            {
+                // usually, the operator here is Q, sometimes EMC (PDFBOX-2376).
+                String s = new String(binCharTestArr, startOpIdx, endOpIdx - startOpIdx);
+                if (!"Q".equals(s) && !"EMC".equals(s))
+                {
+                    noBinData = false;
+                }
+            }
+
             if (readBytes == maxBinCharTestLength) // only if not close to eof
             {
                 // a PDF operator is 1-3 bytes long