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

ArchiveStreamFactory.detect(InputStream) returns TAR for ICO file

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.23.0
    • 1.26.1
    • None
    • None

    Description

      Over on Tika, this file is being detected as a tar file. It is an os/2 bitmap array file.

      We're using ArchiveStreamFactory.detect(), which finds no magic so it gets down to:

      tais = new TarArchiveInputStream(new ByteArrayInputStream(tarHeader));
                                      if (tais.getNextTarEntry().isCheckSumOK())
      

      The next tar entry has length 0 and the checksum of 0 works.

      If you're up for it, it might make sense to check that the next tar entry has a length > 0.

      I realize that this is a trivial/rare problem with a rare or specially crafted file. And, I realize that this only fixes one special case. I'm not sure it makes sense to add complexity to your logic.

      Attachments

        1. ARW05UP.ICO
          0.9 kB
          Tim Allison

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tallison Tim Allison
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: