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

Crash for Softmask with incorrect backdrop color components

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.31, 3.0.2 PDFBox
    • 2.0.32, 3.0.3 PDFBox, 4.0.0
    • Rendering
    • None
    • Patch

    Description

      This error occured in our production of an old archive. None of the files crashed in any other viewer (Chrome, Adobe, Firefox, Poppler a.s.o). 

       

      I've read up on the subject in the 1.7 specification, and it seems like PDFBox is following the specification, but not being able to open these files seems a bit too strict.

       

      The easiest way to reproduce is just to open the attached file with the debugger.

      java -jar debugger-app-4.0.0-SNAPSHOT.jar borsen-2065-20111030-1-p4.pdf 

      The application will crash with this exception:

      Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
          org.apache.pdfbox.pdmodel.graphics.color.PDColor.toRGB(PDColor.java:155)
          org.apache.pdfbox.rendering.PageDrawer$TransparencyGroup.<init>(PageDrawer.java:1696)
          org.apache.pdfbox.rendering.PageDrawer$TransparencyGroup.<init>(PageDrawer.java:1573)
          org.apache.pdfbox.rendering.PageDrawer.applySoftMaskToPaint(PageDrawer.java:604)
          org.apache.pdfbox.rendering.PageDrawer.showTransparencyGroupOnGraphics(PageDrawer.java:1549)
          org.apache.pdfbox.rendering.PageDrawer.showTransparencyGroup(PageDrawer.java:1489)
          org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:81)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:872)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:511)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:489)
          org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:158)
          org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:270)
          org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:346)
          org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:527)
          org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:506)
          java.base/java.lang.Thread.run(Thread.java:833)
       

      My solution, added as a patch, is to add a fallback to the colorspace available in the graphical context. This is working for the files I've tried so far.

      Attachments

        1. crashfix.patch
          0.9 kB
          Daniel Persson
        2. borsen-2065-20111030-1-p4.pdf
          1.55 MB
          Daniel Persson

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: