Details
-
Type: Bug
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 5.1.1, 6.2.2, 6.3.2
-
Fix Version/s: 6.3.3
-
Component/s: Core/Parsing
-
Labels:None
-
Environment:Linux
-
ICEsoft Forum Reference:
Description
As explained in my comment in the forum thread, some PDF files make icepdf enter an infinite loop when looking for the content of an inline image.
{code}
stackTrace:
java.lang.Thread.State: RUNNABLE
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
- locked <0x0000000607eeed68> (a org.icepdf.core.io.BufferedMarkedInputStream)
at org.icepdf.core.io.BufferedMarkedInputStream.read(BufferedMarkedInputStream.java:50)
at org.icepdf.core.util.Parser.peek2(Parser.java:532)
at org.icepdf.core.util.content.OContentParser.parseInlineImage(OContentParser.java:1104)
at org.icepdf.core.util.content.OContentParser.parse(OContentParser.java:550)
at org.icepdf.core.pobjects.Page.init(Page.java:399)
- locked <0x0000000607db6e18> (a org.icepdf.core.pobjects.Page)
at org.icepdf.core.pobjects.Document.getPageImage(Document.java:1142)
{code}
I reproduced this with the 2 PDF files from the forum link and some test code that does
{code}
Document document = new Document();
document.setByteArray(pdf, 0, pdf.length, null);
if (document.getNumberOfPages() <= 0) {
throw new IllegalArgumentException("No page!");
}
BufferedImage image = (BufferedImage) document.getPageImage(0,
GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0f, 1.0f);
ImageIO.write(image, "jpg", baos);
return baos.toByteArray();
{code}
{code}
stackTrace:
java.lang.Thread.State: RUNNABLE
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
- locked <0x0000000607eeed68> (a org.icepdf.core.io.BufferedMarkedInputStream)
at org.icepdf.core.io.BufferedMarkedInputStream.read(BufferedMarkedInputStream.java:50)
at org.icepdf.core.util.Parser.peek2(Parser.java:532)
at org.icepdf.core.util.content.OContentParser.parseInlineImage(OContentParser.java:1104)
at org.icepdf.core.util.content.OContentParser.parse(OContentParser.java:550)
at org.icepdf.core.pobjects.Page.init(Page.java:399)
- locked <0x0000000607db6e18> (a org.icepdf.core.pobjects.Page)
at org.icepdf.core.pobjects.Document.getPageImage(Document.java:1142)
{code}
I reproduced this with the 2 PDF files from the forum link and some test code that does
{code}
Document document = new Document();
document.setByteArray(pdf, 0, pdf.length, null);
if (document.getNumberOfPages() <= 0) {
throw new IllegalArgumentException("No page!");
}
BufferedImage image = (BufferedImage) document.getPageImage(0,
GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0f, 1.0f);
ImageIO.write(image, "jpg", baos);
return baos.toByteArray();
{code}
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Arnaud Jeansen
created issue -
Arnaud Jeansen
made changes -
Field | Original Value | New Value |
---|---|---|
Attachment | infiniteLoop.diff [ 23089 ] |
Arnaud Jeansen
made changes -
Attachment | 0001-SOAT-8160-Fix-the-infinite-loop-with-patch-from-PDF-.patch [ 23098 ] |
Arnaud Jeansen
made changes -
Attachment | infiniteLoop.diff [ 23089 ] |
Arnaud Jeansen
made changes -
Attachment | 098924.pdf [ 23099 ] |
Patrick Corless
made changes -
Fix Version/s | 6.3.3 [ 13282 ] |