Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip file corruption after writing less than 4 GB (with 64 bit I/O) on iOS #4

Closed
ghost opened this issue Jun 22, 2013 · 1 comment
Closed
Labels
1.2 Related to older version of minizip 1.2 api Interface changes zip ZIP file format

Comments

@ghost
Copy link

ghost commented Jun 22, 2013

Hello,

it's again me and it's again an issue on iOS. The sequence to reproduce the problem is the following:

  • create a new file with zipOpen;
  • add a new file to the zip with zipOpenNewFileInZip3 in deflate mode;
  • write uncompressible (e.g.: random) data with zipWriteInFileInZip until you have written 4,294,080,000 bytes (until 4,293,387,000 bytes it works, not sure in the middle);
  • close the file with zipCloseFileInZip.

At this point you will get error -103 (ZIP_BADZIPFILE). The error is produced at line #1808 of zip.c, that is:

        if(uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff)
        {
            if(zi->ci.pos_zip64extrainfo > 0)
            {
                // Update the size in the ZIP64 extended field.
                // [...]
            }
            else
                err = ZIP_BADZIPFILE; // Caller passed zip64 = 0, so no room for zip64 info -> fatal
        }
        else
            // [...]

It seems that when compiling for iOS the library misconfigures the 64 bit I/O APIs in some way.
Best regards,

Gianluca

@nmoinvaz
Copy link
Member

You should use zipOpenNewFileInZip3_64 to enable ZIP64 support. Be sure to set the last parameter to 1.

@nmoinvaz nmoinvaz added 1.2 Related to older version of minizip 1.2 api Interface changes zip ZIP file format labels Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.2 Related to older version of minizip 1.2 api Interface changes zip ZIP file format
Projects
None yet
Development

No branches or pull requests

1 participant