libzip: Improve test archive function
ClosedPublic

Authored by rthomsen on Oct 21 2017, 4:27 PM.

Details

Summary

The old test implementation only opens the archive with some additional checks, but fails to detect archives with CRC errors for entries, e.g. in bug 384622.

We now read each entry and check the CRC checksum against the one given in the file header. We use zlib's crc32() function to compute the checksum.

Test Plan

Open archive attached to bug 384622 and verify that Test Integrity detects the bad checksums.

Diff Detail

Repository
R36 Ark
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rthomsen created this revision.Oct 21 2017, 4:27 PM
Restricted Application added subscribers: Ark, kde-utils-devel. · View Herald TranscriptOct 21 2017, 4:27 PM
elvisangelaccio requested changes to this revision.Oct 21 2017, 4:56 PM
elvisangelaccio added inline comments.
plugins/libzipplugin/CMakeLists.txt
18

Should be marked as REQUIRED

22

"Required for integrity check in libzip plugin"

plugins/libzipplugin/libzipplugin.cpp
429

const

430

spaces around =

440

leak if we go in either of the return false branches.

Use a scoped pointer, so that we can also drop the delete buf below.

441

const

This revision now requires changes to proceed.Oct 21 2017, 4:56 PM
rthomsen updated this revision to Diff 21068.Oct 21 2017, 5:12 PM

Implement ELvis' suggestions.

rthomsen marked 6 inline comments as done.Oct 21 2017, 5:12 PM
elvisangelaccio accepted this revision.Oct 21 2017, 5:25 PM
This revision is now accepted and ready to land.Oct 21 2017, 5:25 PM
This revision was automatically updated to reflect the committed changes.