pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1861934 - in /pdfbox/branches/issue4569: ./ preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Date Sun, 23 Jun 2019 14:33:58 GMT
Author: lehmi
Date: Sun Jun 23 14:33:57 2019
New Revision: 1861934

URL: http://svn.apache.org/viewvc?rev=1861934&view=rev
Log:
PDFBOX-4578: use the correct error number

Modified:
    pdfbox/branches/issue4569/   (props changed)
    pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java

Propchange: pdfbox/branches/issue4569/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jun 23 14:33:57 2019
@@ -1,4 +1,4 @@
 /pdfbox/branches/2.0:1760418,1761484,1762133,1763609,1779822,1780783,1780789,1782684,1784450,1792784,1795704,1795712,1799081-1799082,1814046,1814285,1814459,1824914,1825811,1825820,1825912,1844477,1844516,1844519,1844567,1850577,1857953,1858696,1858698,1860825
 /pdfbox/branches/no-awt:1618517-1621410
 /pdfbox/no-awt:1618514-1618516
-/pdfbox/trunk:1861927
+/pdfbox/trunk:1861927,1861933

Modified: pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java?rev=1861934&r1=1861933&r2=1861934&view=diff
==============================================================================
--- pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
(original)
+++ pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Sun Jun 23 14:33:57 2019
@@ -22,6 +22,7 @@
 package org.apache.pdfbox.preflight.process;
 
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_DAMAGED;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_DELIMITER;
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_FX_KEYS;
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_INVALID_FILTER;
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_LENGTH_INVALID;
@@ -223,14 +224,12 @@ public class StreamValidationProcess ext
                 {
                     int c = ra.read();
                     // "stream" has to be followed by a LF or CRLF
-                    if (c != '\r' && c != '\n')
+                    if ((c != '\r' && c != '\n') //
+                            || (c == '\r' && ra.read() != '\n'))
                     {
-                        addStreamLengthValidationError(context, cObj, length, "");
-                        return;
-                    }
-                    if (c == '\r' && ra.read() != '\n')
-                    {
-                        addStreamLengthValidationError(context, cObj, length, "");
+                        addValidationError(context,
+                                new ValidationError(ERROR_SYNTAX_STREAM_DELIMITER,
+                                        "Expected 'EOL' after the stream keyword not found"));
                         return;
                     }
                     // ---- Here is the true beginning of the Stream Content.
@@ -274,6 +273,9 @@ public class StreamValidationProcess ext
                             || (buffer2[0] == '\n' && buffer2[1] != 'e') //
                             || !endStream.contains(ENDSTREAM))
                     {
+                        // TODO in some cases it is hard to say if the reason for this issue
is a missing EOL or a wrong
+                        // stream length, see isartor-6-1-7-t03-fail-a.pdf
+                        // the implementation has to be adjusted similar to PreflightParser#parseCOSStream
                         addStreamLengthValidationError(context, cObj, length, endStream);
                     }
                 }



Mime
View raw message