You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2011/03/23 14:05:05 UTC

[jira] [Updated] (COMPRESS-84) GZip corrupt files are partially unzipped

     [ https://issues.apache.org/jira/browse/COMPRESS-84?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated COMPRESS-84:
-------------------------

    Component/s: Compressors

> GZip corrupt files are partially unzipped
> -----------------------------------------
>
>                 Key: COMPRESS-84
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-84
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Compressors
>    Affects Versions: 1.0
>         Environment: Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200)
> Java version: 1.6.0_14
> Java home: /opt/jdk1.6.0_14/jre
> Default locale: fr_FR, platform encoding: UTF-8
> OS name: "linux" version: "2.6.30.5-28.rc2.fc11.i586" arch: "i386" Family: "unix"
> In POM : {noformat}
> 		<dependency>
> 			<groupId>org.apache.commons</groupId>
> 			<artifactId>commons-compress</artifactId>
> 			<version>1.0</version>
> 			<type>jar</type>
> 			<scope>compile</scope>
> 		</dependency>{noformat}
>            Reporter: Florent Charton
>
> While trying to decompres gzipped data with random removed bytes, no exceptions are thrown. Same file with zcat command line utility produces error below
> {noformat}gzip: badfiles-red-64/data.txt.gz: invalid compressed data--crc error
> gzip: badfiles-red-64/data.txt.gz: invalid compressed data--length error
> {noformat} 
> The code below should throw an exception about corrupted file
> {code:title=Sample extraction code}
>         CompressorInputStream cis = null;
>         try {
>             cis = new CompressorStreamFactory().createCompressorInputStream(
>                     "gz", new FileInputStream("badfiles-red-64/data.txt.gz"));
>         } catch (CompressorException e) {
>             // This will never happen unless "gz" is changed 2 lines above
>             log.error(e.getMessage(), e);
>             throw new ProcessingException(e);
>         }
>         try {
>             while (cis.read() > 0) {
>             }
>         } catch (IOException e) {
>             log.error(e.getMessage(), e);
>             throw new ProcessingException(e);
>         }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira