commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florent Charton (JIRA)" <j...@apache.org>
Subject [jira] Created: (COMPRESS-84) GZip corrupt files are partially unzipped
Date Thu, 20 Aug 2009 12:25:15 GMT
GZip corrupt files are partially unzipped
-----------------------------------------

                 Key: COMPRESS-84
                 URL: https://issues.apache.org/jira/browse/COMPRESS-84
             Project: Commons Compress
          Issue Type: Bug
    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"
            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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message