Description
org.apache.pdfbox.preflight.process.StreamValidationProcess Length of the stream validation is invalid.
If Stream dictionray contains "\nstream", it find wrong stream start position.
Therefore, it reports an error for the wrong stream length, despite stream length is correct.
PdfWithEmbeddedFileStream.pdf - is an example of PDF containing stream for embedded file stream, which raises an error "ERROR_SYNTAX_STREAM_LENGTH_INVALID: Body Syntax error, Stream length is invalid [cObj=COSObject{18, 0}; defined length=372; buffer2= V6 t ".
The problem was caused by the "/Subtype /application#2Foctet-stream" which contains "stream\n".
Trying to find stream start position it is not enough to search for the "stream".
As a fix I suggest first to skip dictionary bytes.
The fixing code may be find in StreamValidationProcessFixedBugPdfBox_4925.java.