You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oleksii Khomchenko (Jira)" <ji...@apache.org> on 2021/02/10 08:52:00 UTC
[jira] [Commented] (COMPRESS-562) ZipArchiveInputStream fails with
unexpected record signature while ZipInputStream from java.util.zip
succeeds
[ https://issues.apache.org/jira/browse/COMPRESS-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17282311#comment-17282311 ]
Oleksii Khomchenko commented on COMPRESS-562:
---------------------------------------------
Good evening.
I apologize for a late reply, got overwhelmed at work. I really appreciate your findings, thank you a lot for insights.
I am curious what do you think about potential lenient option for ZipArchiveInputStream. I assume it can be tricky as random zero bytes before signing block is only one case out of many of them.
I will consider using ZipFile for my case.
Thank you again.
> ZipArchiveInputStream fails with unexpected record signature while ZipInputStream from java.util.zip succeeds
> -------------------------------------------------------------------------------------------------------------
>
> Key: COMPRESS-562
> URL: https://issues.apache.org/jira/browse/COMPRESS-562
> Project: Commons Compress
> Issue Type: Bug
> Components: Archivers
> Affects Versions: 1.20
> Environment: Zip 3.0 (July 5th 2008), by Info-ZIP, Compiled with gcc 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14) for Unix (Mac OS X) on Feb 22 2019.
> osx 10.14.6, AdoptOpenJDK 11.0.7
> Reporter: Oleksii Khomchenko
> Priority: Major
> Attachments: apk.PNG, test-services-1.1.0.apk
>
>
> Thank you a lot for the library.
>
> I recently encountered next issue:
> {code:java}
> Exception in thread "main" java.util.zip.ZipException: Unexpected record signature: 0X0
> {code}
> is thrown when reading test-services-1.1.0.apk from [https://maven.google.com/web/index.html?q=test-ser#androidx.test.services:test-services:1.1.0] via commons-compress:1.20 while java.util.zip reads it without the exception.
>
> {code:java}
> public class UnzipTestServicesSample {
> public static void main(String[] args) throws Exception {
> Path p = Paths.get("test-services-1.1.0.apk");
> System.out.println("\n=== java std zip ===\n");
> try (InputStream is = Files.newInputStream(p); ZipInputStream zis = new ZipInputStream(is)) {
> ZipEntry entry;
> while ((entry = zis.getNextEntry()) != null) {
> System.out.println("entry: " + entry.getName());
> }
> }
> System.out.println("\n=== apache compress zip ===\n");
> try (InputStream is = Files.newInputStream(p); ArchiveInputStream ais = new ZipArchiveInputStream(is)) {
> ArchiveEntry entry;
> while ((entry = ais.getNextEntry()) != null) {
> System.out.println("entry: " + entry.getName());
> }
> }
> }
> }{code}
>
> zip -T says that archive is fine:
>
> {code:java}
> $ zip -T test-services-1.1.0.apk
> test of test-services-1.1.0.apk OK{code}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)