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

TarArchiveInputStream silently finished when unexpected EOF occured

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7, 1.8
    • Fix Version/s: 1.8.1
    • Component/s: Archivers
    • Labels:
    • Environment:

      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. TarArchiveInputStream.java.patch
          0.9 kB
          David Mollitor
        2. trim.tar
          19 kB
          PeterL in
        3. trim.tar.bz2
          6 kB
          PeterL in
        4. complete.tar
          20 kB
          PeterL in

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: