You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2019/04/18 19:02:00 UTC

[jira] [Commented] (COMPRESS-480) Unexpected record signature when using ZipArchiveInputStream

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

Stefan Bodewig commented on COMPRESS-480:
-----------------------------------------

Unfortunately your archive is of the kind that can not be read by {{ZipArchiveInputStream}}.

To make things worse, I seem to have found a bug while analyzing the way we handle the archive - COMPRESS-482.

Let me first explain what will happen once I have fixed the bug.: The stored entry that claims to use a data descriptor contains a ZIP archive (an XPI file). The way the feature works for {{ZipArchiveInputStream}} is by reading ahead until the stream contains something that looks like the next entry. In this case this would be the second entry of the XPI file. From that point on {{ZipArchiveInputStream}} will continue reading the embedded XPI and finish once it hits the central directory of the embedded file. So once I fix the bug you will not get any exceptions anymore but not get the contents of your archive either.

Finally we could very the uncompressed size read from the data descriptor actually matches the amount of bytes we've read before the data descriptor - and throw an exception if there is a mismatch: COMPRESS-483,

> Unexpected record signature when using ZipArchiveInputStream
> ------------------------------------------------------------
>
>                 Key: COMPRESS-480
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-480
>             Project: Commons Compress
>          Issue Type: Bug
>    Affects Versions: 1.18
>            Reporter: Luboš Doležel
>            Priority: Major
>
> I'm trying to use ZipArchiveInputStream for reading a [Firefox APK|https://www.dropbox.com/s/u725t87sew5b539/firefox-65-0-1.apk?dl=0]. I cannot use ZipFile (although the example below _could_) and I'm aware of the limitations.
> The file makes use of "stored entries with data descriptor".
> This code example triggers an exception:
> {code}
> ZipArchiveInputStream zis = new ZipArchiveInputStream(new FileInputStream(apk), "UTF-8", false, true);
> while (zis.getNextZipEntry() != null);
> {code}
> This is the exception reported: {{Unexpected record signature: 0X4374756F}}
> Could it possibly be fixed or is this ZIP file impossible to read using ZipArchiveInputStream?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)