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

CRC32 checksum failed on valid zip #542

Closed
issacgerges opened this issue Sep 17, 2024 · 0 comments · Fixed by #543
Closed

CRC32 checksum failed on valid zip #542

issacgerges opened this issue Sep 17, 2024 · 0 comments · Fixed by #543

Comments

@issacgerges
Copy link
Contributor

issacgerges commented Sep 17, 2024

The following zip, crafted using https://en.wikipedia.org/wiki/ZIP_(file_format)#Data_descriptor fails CRC checks although valid and unzippable by the OS. This zip should be usable as a future test case as it mirrors your other good_crc zip

good_crc_trailing_data_descriptor.zip

    it("Good CRC - trailing data descriptor ", (done) => {
        const goodZip = new Zip(path.join(__dirname, "good_crc_trailing_data_descriptor.zip"));
        const entries = goodZip.getEntries();
        assert(entries.length === 1, "Good CRC: Test archive contains exactly 1 file");

        const testFile = entries.filter(function (entry) {
            return entry.entryName === "lorem_ipsum.txt";
        });
        assert(testFile.length === 1, "Good CRC: lorem_ipsum.txt file exists as archive entry");

        const testFileEntryName = testFile[0].entryName;
        goodZip.readAsTextAsync(testFileEntryName, function (data, err) {
            assert(!err, "Good CRC: error object not present");
            assert(data && data.length, "Good CRC: buffer not empty");
            done();
        });
    });
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

Successfully merging a pull request may close this issue.

1 participant