marmelroy / Zip

Swift framework for zipping and unzipping files.
MIT License
2.49k stars 449 forks source link

Unzipping file (zipped with this same package) fails #265

Open finestructure opened 3 months ago

finestructure commented 3 months ago

I've traced this to line 369 in unzip.c where uL != ZIP64ENDLOCHEADERMAGIC is true and as a consequence unz64local_SearchCentralDir64 returns 0, leading to UNZ_BADZIPFILE in unzOpenInternal.

    /* read locator signature */
    if (unz64local_getLong(pzlib_filefunc_def, filestream, &uL) != UNZ_OK)
        return 0;
    if (uL != ZIP64ENDLOCHEADERMAGIC)
        return 0;

I can't tell if it's the zipping or the unzipping that's tripping up. I'm attaching the file (which unzips just fine in Finder, FWIW).

All this is with Zip 2.1.2

prod-apple-swift-metrics-main-e6a00d36.zip

finestructure commented 3 months ago

I've got a test showing the issue here: https://github.com/SwiftPackageIndex/DocUploader/blob/9005466e9c52e7c5a6b9c07d908e059c4de9c2e6/Tests/DocUploadBundleTests/DocUploadBundleTests.swift#L108