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

TarArchiveInputStream.matches() only works for tar archives whose first file is "test1.xml"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.0
    • None
    • None

    Description

      The tar header format does not have a "magic" number at the start, so in general it is impossible to tell if an input file is a tar file without reading a lot more data.

      The current match() implementation assumes the first 8 bytes contain "test1.xml", which is obviously a hack for testing purposes.

      If more bytes are read from the input, it might be possible to implement a working match() method:

      The file must be at least 512 bytes long.

      The following offsets have contents that could be checked:

      Offset len
      148 8 Checksum for header block
      156 1 Link indicator (file type) - '0'-'6' or null

      Other possible checks are:

      • numeric fields must be octal
      • filename fields must end in trailing nulls (but can a filename contain a null?)

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: