Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4925

Invalid stream Length validation in StreamValidationProcess

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.19, 2.0.20
    • 2.0.27
    • Preflight
    • None

    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.

       

       

      Attachments

        1. StreamValidationProcessFixedBugPdfBox_4925.java
          14 kB
          Adomas Birštunas
        2. PdfWithEmbeddedFileStream.pdf
          70 kB
          Adomas Birštunas

        Activity

          People

            lehmi Andreas Lehmkühler
            abirstunas Adomas Birštunas
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: