Tim Allison created COMPRESS-644:
------------------------------------
Summary: Don't trust tar detection on zero byte record?
Key: COMPRESS-644
URL: https://issues.apache.org/jira/browse/COMPRESS-644
Project: Commons Compress
Issue Type: Improvement
Reporter: Tim Allison
Attachments: ARW05UP.ICO
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:
{noformat}
tais = new TarArchiveInputStream(new ByteArrayInputStream(tarHeader));
if (tais.getNextTarEntry().isCheckSumOK())
{noformat}
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)