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

Stack overflow around PDFStreamEngine.processStream

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.16, 2.0.12
    • 1.8.17, 2.0.13, 3.0.0 PDFBox
    • PDModel
    • None

    Description

      java.lang.StackOverflowError: null
          java.lang.ref.Finalizer.<init>(Unknown Source)
          java.lang.ref.Finalizer.register(Unknown Source)
          java.lang.Object.<init>(Unknown Source)
          java.util.zip.Inflater.<init>(Unknown Source)
          org.apache.pdfbox.filter.FlateFilter.decompress(FlateFilter.java:74)
          org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:50)
          org.apache.pdfbox.filter.Filter.decode(Filter.java:87)
          org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:77)
          org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:178)
          org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:166)
          org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject.getContents(PDFormXObject.java:144)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:495)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:70)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478)
          org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:187)
      ...
      

      The cause is that one of the form XObjects has a resource entry but that is null. So in PDFStreamEngine the parent resources is used. This results that form Fm0, which has "/Fm0 Do", references itself.

      The solution for now is to return an empty resouces instead of null when the key exists.

      Attachments

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              tilman Tilman Hausherr
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: