Skip to content

CRC32 checksum failed on valid zip #542

Closed

Description

@issacgerges

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();
        });
    });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions