You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Sean Bridges (JIRA)" <ji...@apache.org> on 2009/05/13 19:15:45 UTC
[jira] Created: (PDFBOX-470) corrupt zip stream causes document to
not parse
corrupt zip stream causes document to not parse
-----------------------------------------------
Key: PDFBOX-470
URL: https://issues.apache.org/jira/browse/PDFBOX-470
Project: PDFBox
Issue Type: Bug
Affects Versions: 0.8.0-incubator
Reporter: Sean Bridges
This is with svn revision 774426
PDFParser is not very forgiving with respect to bad compressed input streams. I am processing a set of 13,000 pdf files, and I see 10 exceptions of the form,
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
And one,
Caused by: java.util.zip.ZipException: invalid bit length repeat
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
It would be nice if we could recover from this error, rather than failing to parse the file. By commenting out line 314 of COSStrean
if( !done )
{
//throw exception;
}
The parser works correctly, and I am able to extract text from these documents.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-470) corrupt zip stream causes document
to not parse
Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709084#action_12709084 ]
Andreas Lehmkühler commented on PDFBOX-470:
-------------------------------------------
Perhaps it would be sufficient to add some more catch-clauses for these exceptions to the FlateFilter (see PDFBOX-453)
> corrupt zip stream causes document to not parse
> -----------------------------------------------
>
> Key: PDFBOX-470
> URL: https://issues.apache.org/jira/browse/PDFBOX-470
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Reporter: Sean Bridges
>
> This is with svn revision 774426
> PDFParser is not very forgiving with respect to bad compressed input streams. I am processing a set of 13,000 pdf files, and I see 10 exceptions of the form,
> Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
> at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
> at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
> at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
> at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
> at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
> at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
> at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
> And one,
> Caused by: java.util.zip.ZipException: invalid bit length repeat
> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
> at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
> at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
> at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
> at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
> at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
> at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
> It would be nice if we could recover from this error, rather than failing to parse the file. By commenting out line 314 of COSStrean
> if( !done )
> {
> //throw exception;
> }
> The parser works correctly, and I am able to extract text from these documents.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (PDFBOX-470) corrupt zip stream causes document to
not parse
Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler resolved PDFBOX-470.
---------------------------------------
Resolution: Fixed
Fix Version/s: 0.8.0-incubator
With version 790959 pdfbox will catch EOFExceptions and ZipExceptions if an issue occurs during decoding in the FlateFilter class
Thanks to Sean for his help
> corrupt zip stream causes document to not parse
> -----------------------------------------------
>
> Key: PDFBOX-470
> URL: https://issues.apache.org/jira/browse/PDFBOX-470
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Reporter: Sean Bridges
> Fix For: 0.8.0-incubator
>
>
> This is with svn revision 774426
> PDFParser is not very forgiving with respect to bad compressed input streams. I am processing a set of 13,000 pdf files, and I see 10 exceptions of the form,
> Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
> at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
> at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
> at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
> at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
> at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
> at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
> at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
> And one,
> Caused by: java.util.zip.ZipException: invalid bit length repeat
> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
> at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
> at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
> at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
> at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
> at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
> at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
> It would be nice if we could recover from this error, rather than failing to parse the file. By commenting out line 314 of COSStrean
> if( !done )
> {
> //throw exception;
> }
> The parser works correctly, and I am able to extract text from these documents.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-470) corrupt zip stream causes document
to not parse
Posted by "Sean Bridges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709090#action_12709090 ]
Sean Bridges commented on PDFBOX-470:
-------------------------------------
Catching ZipException and EOFException in FlatFilter.decode would work as well.
> corrupt zip stream causes document to not parse
> -----------------------------------------------
>
> Key: PDFBOX-470
> URL: https://issues.apache.org/jira/browse/PDFBOX-470
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 0.8.0-incubator
> Reporter: Sean Bridges
>
> This is with svn revision 774426
> PDFParser is not very forgiving with respect to bad compressed input streams. I am processing a set of 13,000 pdf files, and I see 10 exceptions of the form,
> Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
> at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
> at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
> at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
> at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
> at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
> at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
> at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
> And one,
> Caused by: java.util.zip.ZipException: invalid bit length repeat
> at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
> at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:101)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:301)
> at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:221)
> at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:156)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.<init>(PDFStreamParser.java:87)
> at org.apache.pdfbox.cos.COSStream.getStreamTokens(COSStream.java:118)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:204)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:176)
> at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:358)
> at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:282)
> at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:238)
> at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:171)
> It would be nice if we could recover from this error, rather than failing to parse the file. By commenting out line 314 of COSStrean
> if( !done )
> {
> //throw exception;
> }
> The parser works correctly, and I am able to extract text from these documents.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.