ICEpdf
  1. ICEpdf
  2. PDF-327

ArrayIndexOutOfBoundsException in JBIG2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.2
    • Fix Version/s: 5.0.4
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      -
    • Salesforce Case Reference:

      Description

      The PDF does not render the following exception is thrown:

      FINE: Error getting image by name: Im0
      java.lang.ArrayIndexOutOfBoundsException: 1
      at org.jpedal.jbig2.io.StreamReader.readByte(StreamReader.java:93)
      at org.jpedal.jbig2.decoders.JBIG2StreamDecoder.handleSegmentNumber(JBIG2StreamDecoder.java:504)
      at org.jpedal.jbig2.decoders.JBIG2StreamDecoder.readSegmentHeader(JBIG2StreamDecoder.java:470)
      at org.jpedal.jbig2.decoders.JBIG2StreamDecoder.readSegments(JBIG2StreamDecoder.java:225)
      at org.jpedal.jbig2.decoders.JBIG2StreamDecoder.decodeJBIG2(JBIG2StreamDecoder.java:134)
      at org.jpedal.jbig2.JBIG2Decoder.decodeJBIG2(JBIG2Decoder.java:149)
      at org.icepdf.core.pobjects.Stream.jbig2Decode(Stream.java:867)
      at org.icepdf.core.pobjects.Stream.getImage(Stream.java:2131)
      at org.icepdf.core.pobjects.Stream.getImage(Stream.java:2042)
      at org.icepdf.core.pobjects.Resources.getImage(Resources.java:264)
      at org.icepdf.core.util.ContentParser.consume_Do(ContentParser.java:1971)
      at org.icepdf.core.util.ContentParser.parse(ContentParser.java:391)
      at org.icepdf.core.pobjects.Page.init(Page.java:390)
      at org.icepdf.core.views.swing.PageViewComponentImpl$PageInitilizer.run(PageViewComponentImpl.java:1077)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)

      This user has also logged PDF-278.
      1. 10692.pdf
        87 kB
        Tyler Johnson
      2. sc10452.pdf
        253 kB
        Tyler Johnson

        Activity

        Hide
        Patrick Corless added a comment -

        This is a strange bug but should be relatively easy to fix. The jbig images decodeParams points to an empty stream object (13 0 obj) that has a specific length of zero. Our stream parser seem to ignore this and return a few bytes between the stream .. endstream which is throwing off the jbig decoder.

        We can take a look at fixing the stream parser to check the stream length or we can add a few checks in the jbig decode to makes sure the decode params length is valid.

        Show
        Patrick Corless added a comment - This is a strange bug but should be relatively easy to fix. The jbig images decodeParams points to an empty stream object (13 0 obj) that has a specific length of zero. Our stream parser seem to ignore this and return a few bytes between the stream .. endstream which is throwing off the jbig decoder. We can take a look at fixing the stream parser to check the stream length or we can add a few checks in the jbig decode to makes sure the decode params length is valid.
        Hide
        Tyler Johnson added a comment -

        Same customer has reported another very similar issue in that the exceptions are the same. Attaching PDF.

        Show
        Tyler Johnson added a comment - Same customer has reported another very similar issue in that the exceptions are the same. Attaching PDF.
        Hide
        Patrick Corless added a comment -

        Likely also related to PDF-342 moving out to 5.0.

        Show
        Patrick Corless added a comment - Likely also related to PDF-342 moving out to 5.0.
        Hide
        Patrick Corless added a comment -

        We've secured a license for a new JIG2 library that can correctly decode the examples in question. We'll e adding the new library in 5.1 PRO.

        Show
        Patrick Corless added a comment - We've secured a license for a new JIG2 library that can correctly decode the examples in question. We'll e adding the new library in 5.1 PRO.
        Hide
        Patrick Corless added a comment -

        We are moving away from the jbig2 implementation provided by jpedal and are moving to the Levigo library. The library is licensed under LGPA so we won't be distributing it with the OS bundle but if added to the class path ICEpdf will try to use it.

        We licensed a special commercial version of Levigo which we are shipping with the PRO version for our enterprise customers.

        Show
        Patrick Corless added a comment - We are moving away from the jbig2 implementation provided by jpedal and are moving to the Levigo library. The library is licensed under LGPA so we won't be distributing it with the OS bundle but if added to the class path ICEpdf will try to use it. We licensed a special commercial version of Levigo which we are shipping with the PRO version for our enterprise customers.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: