You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2019/06/23 14:33:08 UTC
svn commit: r1861933 -
/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Author: lehmi
Date: Sun Jun 23 14:33:08 2019
New Revision: 1861933
URL: http://svn.apache.org/viewvc?rev=1861933&view=rev
Log:
PDFBOX-4578: use the correct error number
Modified:
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java?rev=1861933&r1=1861932&r2=1861933&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java Sun Jun 23 14:33:08 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);
}
}