[ 
https://issues.apache.org/jira/browse/COMPRESS-644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory updated COMPRESS-644:
-------------------------------------
    Summary: ArchiveStreamFactory.detect(InputStream) returns TAR for ICO file  
(was: Don't trust tar detection on zero byte record?)

> ArchiveStreamFactory.detect(InputStream) returns TAR for ICO file
> -----------------------------------------------------------------
>
>                 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)

Reply via email to