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

TarArchiveInputStream silently finished when unexpected EOF occured

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7, 1.8
    • 1.8.1
    • Archivers
    • Common Compress 1.7 + openJDK 1.7

    Description

      I just found the following test case didn't raise an IOException as it used to be for a tar trimmed on purpose

      @Test
      public void testCorruptedBzip2() throws IOException {
      String archivePath = PathUtil.join(testdataDir, "test.tar.bz2");
      TarArchiveInputStream input = null;
      input = new TarArchiveInputStream(new BZip2CompressorInputStream(
      GoogleFile.SYSTEM.newInputStream(archivePath), true));
      ArchiveEntry nextMatchedEntry = input.getNextEntry();
      while (nextMatchedEntry != null)

      { logger.infofmt("Extracting %s", nextMatchedEntry.getName()); String outputPath = PathUtil.join("/tmp/", nextMatchedEntry.getName()); OutputStream out = new FileOutputStream(outputPath); ByteStreams.copy(input, out); out.close(); nextMatchedEntry = input.getNextEntry(); }

      }

      Attachments

        1. complete.tar
          20 kB
          PeterL in
        2. TarArchiveInputStream.java.patch
          0.9 kB
          David Mollitor
        3. trim.tar
          19 kB
          PeterL in
        4. trim.tar.bz2
          6 kB
          PeterL in

        Activity

          People

            Unassigned Unassigned
            itspeter PeterL in
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: