Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-84

GZip corrupt files are partially unzipped

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.0
    • None
    • Compressors
    • None

    Description

      While trying to decompres gzipped data with random removed bytes, no exceptions are thrown. Same file with zcat command line utility produces error below

      gzip: badfiles-red-64/data.txt.gz: invalid compressed data--crc error
      gzip: badfiles-red-64/data.txt.gz: invalid compressed data--length error
      

      The code below should throw an exception about corrupted file

      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);
              }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            traydent Florent Charton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: