[ 
https://issues.apache.org/jira/browse/COMPRESS-644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722381#comment-17722381
 ] 

Gary D. Gregory commented on COMPRESS-644:
------------------------------------------

Hi [~tallison]
Thank you for your report.
Am I correct in assuming that your suggestion would cause the method to throw 
an {{ArchiveException}} in this case?
It would be clearer if you would provide a PR on GitHub. Note that I added the 
ICO file to the repo here: 
{{src/test/resources/org/apache/commons/compress/COMPRESS-644/ARW05UP.ICO}}



> 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
>            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)

Reply via email to