Skip to content

Rewrite KZip file parsing

Albert Astals Cid requested to merge work/aacid/450597 into master

The old file parser was reading the file in order looking for the local header and central directory header markers, but that breaks when those markers are part of the data of the files inside the zip file itself.

The correct way is to scan for the end of central directory record signature and then from there use the offsets to jump to the rest of the data.

BUGS: 450597

TODO:

  • Doesn't work on sequential IO devices, do we care?
  • The two test files introduced because of https://marc.info/?l=kde-frameworks-devel&m=142402457702039&w=2 fail, the end of central directory record has a broken offset, do we care? Ark (using libarchive?) can't open them either
  • Add an autotest with the files that didn't use to work and now work
Edited by Albert Astals Cid

Merge request reports