pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maison (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PDFBOX-4602) Inline image parsing sometimes fails
Date Mon, 22 Jul 2019 10:33:00 GMT
Maison created PDFBOX-4602:
------------------------------

             Summary: Inline image parsing sometimes fails
                 Key: PDFBOX-4602
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4602
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing, Rendering
    Affects Versions: 2.0.16
            Reporter: Maison


We encounter some pdf containing inline images, and when rendering some of them trigger exceptions
like :

{{javax.imageio.IIOException: Not a JPEG stream (starts with: 0x0aff, expected SOI: 0xffd8)
	at com.twelvemonkeys.imageio.plugins.jpeg.JPEGSegmentImageInputStream.streamInit(JPEGSegmentImageInputStream.java:247)
	at com.twelvemonkeys.imageio.plugins.jpeg.JPEGSegmentImageInputStream.fetchSegment(JPEGSegmentImageInputStream.java:71)
	at com.twelvemonkeys.imageio.plugins.jpeg.JPEGSegmentImageInputStream.repositionAsNecessary(JPEGSegmentImageInputStream.java:267)
	at com.twelvemonkeys.imageio.plugins.jpeg.JPEGSegmentImageInputStream.read(JPEGSegmentImageInputStream.java:302)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInputData(JPEGImageReader.java:312)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:620)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:347)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:492)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:613)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1070)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readRaster(JPEGImageReader.java:1471)
	at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.readRaster(JPEGImageReader.java:920)
	at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:98)
	at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:169)
	at org.apache.pdfbox.pdmodel.graphics.image.PDInlineImage.<init>(PDInlineImage.java:89)
	at org.apache.pdfbox.contentstream.operator.graphics.BeginInlineImage.process(BeginInlineImage.java:43)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
	at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:254)
	at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:245)
	at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:179)}}

This seems to be caused by a NL=0x0a byte just after ID, and it seems that the parser expects
the first image data byte right after ID.
A space after ID seems valid according to pdf reference 1.7 example 4.30



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message