TarArchiveInputStream.matches() only works for tar archives whose first file is
"test1.xml"
-------------------------------------------------------------------------------------------
Key: COMPRESS-65
URL: https://issues.apache.org/jira/browse/COMPRESS-65
Project: Commons Compress
Issue Type: Bug
Reporter: Sebb
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?)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.