Details
-
Type: Bug
-
Status: Closed
-
Priority: 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 loggedPDF-278.
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
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.