commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMPRESS-174) BZip2CompressorInputStream doesn't handle being given a wrong-format compressed file
Date Fri, 18 Apr 2014 13:41:15 GMT

    [ https://issues.apache.org/jira/browse/COMPRESS-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13974080#comment-13974080
] 

Stefan Bodewig commented on COMPRESS-174:
-----------------------------------------

added a test with svn revision 1588467 - and I'm a bit surprised.  The test throws the expected
IOException but from searching through the code it should have done so for many years and
even in 1.3.  Unfortunately we've never really tried to understand the problem back then.

I'll re-close the bug.  

Daniel, if you somehow manage to pass by the format check performed inside the constructor
with a stream that's not a BZIP2 stream, then please reopen this issue with more information.
 If you are talking about a corrupted BZIP2 stream then please create a new issue and provide
a stacktrace so we get something to work from.

Thanks.

> BZip2CompressorInputStream doesn't handle being given a wrong-format compressed file
> ------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-174
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-174
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Compressors
>    Affects Versions: 1.3
>         Environment: Linux and Windows
>            Reporter: Andrew Pavlin
>            Priority: Minor
>
> When reading a file through BZip2CompressorInputStream, and the user selects a file of
the wrong type (such as ZIP or GZIP), the read blows up with a strange ArrayIndexOutOfBoundException,
instead of reporting immediately that the input data is of the wrong format.
> The Bzip2Compressor should be able to identify whether a stream is of BZip2 format or
not, and immediately reject it with a meaningful exception (example: "ProtocolException: not
a BZip2 compressed file").
> Alternatively, are there functions in commons-compress that can identify the compression
type of an InputStream by inspection?
> Example stack trace when using a ZIP input file:
> Exception in thread "OSM Decompressor" java.lang.ArrayIndexOutOfBoundsException: 900000

>         at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.getAndMoveToFrontDecode(BZip2CompressorInputStream.java:688)

>         at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.initBlock(BZip2CompressorInputStream.java:322)

>         at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.setupNoRandPartA(BZip2CompressorInputStream.java:880)

>         at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.setupNoRandPartB(BZip2CompressorInputStream.java:936)

>         at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.read0(BZip2CompressorInputStream.java:228)

>         at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.read(BZip2CompressorInputStream.java:180)

>         at java.io.InputStream.read(InputStream.java:82) 
>         at org.ka2ddo.yaac.osm.OsmXmlSegmenter$1.run(OsmXmlSegmenter.java:129) 
>         at java.lang.Thread.run(Thread.java:680) 
>  



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message