Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 11F28D18E for ; Sun, 5 Aug 2012 19:58:03 +0000 (UTC) Received: (qmail 65068 invoked by uid 500); 5 Aug 2012 19:58:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 64991 invoked by uid 500); 5 Aug 2012 19:58:02 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 64982 invoked by uid 99); 5 Aug 2012 19:58:02 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Aug 2012 19:58:02 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 8367C142822 for ; Sun, 5 Aug 2012 19:58:02 +0000 (UTC) Date: Sun, 5 Aug 2012 19:58:02 +0000 (UTC) From: "Jukka Zitting (JIRA)" To: issues@commons.apache.org Message-ID: <1442731247.15133.1344196682540.JavaMail.jiratomcat@issues-vm> In-Reply-To: <227892173.1419.1328069338726.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (COMPRESS-174) BZip2CompressorInputStream doesn't handle being given a wrong-format compressed file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COMPRESS-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jukka Zitting resolved COMPRESS-174. ------------------------------------ Resolution: Not A Problem Resolving as Not A Problem based on the existing CompressorStreamFactory functionality mentioned above by Sebb. > 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 is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira