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

zip64 self executing jar issue #2712

@reevesg

Description

@reevesg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions