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

End of data reached ... Corrupted zip ? #543

Open
mljsgto222 opened this issue Aug 21, 2018 · 7 comments
Open

End of data reached ... Corrupted zip ? #543

mljsgto222 opened this issue Aug 21, 2018 · 7 comments

Comments

@mljsgto222
Copy link
Contributor

jszip version: 3.1.5
zip file:
app_mage_v1.0.8_201808201647_mi_release.zip

Cannot unzip my signed apk generated by android studio, but debug apk work fine.

Error: End of data reached (data length = 23619650, asked index = 23640109). Corrupted zip ?
    at Uint8ArrayReader.checkIndex (DataReader.js:26)
    at Uint8ArrayReader.checkOffset (DataReader.js:17)
    at Uint8ArrayReader.webpackJsonp.../../../../jszip/lib/reader/Uint8ArrayReader.js.Uint8ArrayReader.readData (Uint8ArrayReader.js:13)

I found this is because of jsZip got extraFieldsLength is 3 when read the central part of a zip file named resources.ascr and extra field data is 0x000000.Then lib/zipEntry.js:193:readExtraFields out of index.

Is that my apk corrupted?

I changed readExtraFields to fix is error:

    readExtraFields: function(reader) {
        var end = reader.index + this.extraFieldsLength,
            extraFieldId,
            extraFieldLength,
            extraFieldValue;

        if (!this.extraFields) {
            this.extraFields = {};
        }

        while (reader.index + 4 < end) {
            extraFieldId = reader.readInt(2);
            extraFieldLength = reader.readInt(2);
            extraFieldValue = reader.readData(extraFieldLength);

            this.extraFields[extraFieldId] = {
                id: extraFieldId,
                length: extraFieldLength,
                value: extraFieldValue
            };
        }

        reader.setIndex(end);
    }
@dazzlersa
Copy link

Hi Mlksgto222

Where did you make those changes? I am having the same error.

@mljsgto222
Copy link
Contributor Author

#544

@nitinmagdumvista
Copy link

error reading zip Error: End of data reached (data length = 4290048, asked index = 4338619). Corrupted zip ?
at NodeBufferReader.checkIndex (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/reader/DataReader.js:26:19)
at NodeBufferReader.checkOffset (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/reader/DataReader.js:17:14)
at NodeBufferReader.readData (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/reader/NodeBufferReader.js:14:10)
at ZipEntries.readBlockEndOfCentral (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/zipEntries.js:59:38)
at ZipEntries.readEndOfCentral (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/zipEntries.js:177:14)
at ZipEntries.load (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip[[?1;2c24m/lib/zipEntries.js:255:14)
at /Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/load.js:48:24
at processTicksAndRejections (node:internal/process/task_queues:96:5)

@trevor-e
Copy link

I'm also seeing this error for some zip files created by Ruby's rubyzip gem. The zip files work fine elsewhere.

@mljsgto222
Copy link
Contributor Author

error reading zip Error: End of data reached (data length = 4290048, asked index = 4338619). Corrupted zip ? at NodeBufferReader.checkIndex (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/reader/DataReader.js:26:19) at NodeBufferReader.checkOffset (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/reader/DataReader.js:17:14) at NodeBufferReader.readData (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/reader/NodeBufferReader.js:14:10) at ZipEntries.readBlockEndOfCentral (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/zipEntries.js:59:38) at ZipEntries.readEndOfCentral (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/zipEntries.js:177:14) at ZipEntries.load (/Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip[[?1;2c24m/lib/zipEntries.js:255:14) at /Users/nitinshamaravmagdum/Documents/Project_List/logos-service/node_modules/jszip/lib/load.js:48:24 at processTicksAndRejections (node:internal/process/task_queues:96:5)

This issue is likely caused by different factors. Could you provide a zip file that can reproduce the problem?

@EmersonCDias
Copy link

Hello guys, would you have any updates on that? I'm facing the same problem.

Tks in advance.

@kalenmike
Copy link

Same issue here for larger files.

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

No branches or pull requests

6 participants