Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

zip64 self executing jar issue #2712

Open
reevesg opened this issue Jun 15, 2022 · 0 comments
Open

zip64 self executing jar issue #2712

reevesg opened this issue Jun 15, 2022 · 0 comments

Comments

@reevesg
Copy link

reevesg commented Jun 15, 2022

We've run into an issue where are jars no longer work if they cross the zip64 threshold and also use a self executing bash script that is appended to the start of the archive. When trying to inspect the contents of the archive we get an error such as

jar -tf  buck-out/gen/src/myselfexecutingjar                                                          
java.util.zip.ZipException: invalid CEN header (bad signature)                                                                                                                                            
        at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)                                                                                                                               
        at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1557)                                                                                                                              
        at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308)                                                                                                                               
        at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)                                                                                                                                  
        at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)                                                                                                                     
        at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)                                                                                                                        
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:248)                                                                                                                                       
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)                                                                                                                                       
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:148)

zip-info highlights the problem as

zipinfo -v buck-out/gen/src/myselfexecutingjar  | less                                                                                                   
[buck-out/gen/src/od-transform/od-transform]                                                                                                                                                              
error: End-of-centdir-64 signature not where expected (prepended bytes?)                                                                                                                                  
  (attempting to process anyway)                                                                                                                                                                          
warning [buck-out/gen/src/myselfexecutingjar]:  1020 extra bytes at beginning or within zipfile 
...

1020 bytes is what we are prepending to the archive and if I add this to the offset in the zip64 EOCD record it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant