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

TarArchiveInputStream#getNextTarEntry does not fail on truncated archive

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.20
    • 1.21
    • Archivers
    • None

    Description

      The following should throw IOException when given a truncated tar:

      TarArchiveInputStream tarInput = new TarArchiveInputStream(inputStream);
      TarArchiveEntry currentEntry;
      while ((currentEntry = tarInput.getNextTarEntry()) != null) {
      }
      

      Instead, it completes successfully. I've included a small simple .tar, and a truncated version of it. Untaring from the command line fails properly:

      $ tar -tf test_truncated.tar
      test/
      tar: Truncated tar archive
      tar: Error exit delayed from previous errors.

      Attachments

        1. test.tar
          4 kB
          Aditya Prasad
        2. test_truncated.tar
          2 kB
          Aditya Prasad

        Activity

          People

            peterlee Peter Lee
            monktastic Aditya Prasad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: