[
https://issues.apache.org/jira/browse/COMPRESS-644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722800#comment-17722800
]
Tim Allison commented on COMPRESS-644:
--------------------------------------
Y, I was thinking something like this:
https://github.com/apache/commons-compress/pull/386
> 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
> Affects Versions: 1.23.0
> Reporter: Tim Allison
> Priority: Trivial
> 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)