Bug 403899 - KArchive should support Zip64
Summary: KArchive should support Zip64
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-karchive
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-03 18:55 UTC by Halla Rempt
Modified: 2025-05-02 03:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halla Rempt 2019-02-03 18:55:11 UTC
Currently, kzip cannot handle zip64 files. Quazip can handle that, so Krita has switched over to that library. However, KArchive should support it too, so e.g. kimageformat plugins can access zip64 kra files. Plus, it would be nice to switch back :-)
Comment 1 Bug Janitor Service 2025-03-27 01:42:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/karchive/-/merge_requests/109
Comment 2 Stefan Brüns 2025-03-30 19:05:20 UTC
Git commit ce749a2cb1bccc02f89cfe3536207d71b8cf0657 by Stefan Brüns.
Committed on 30/03/2025 at 19:03.
Pushed by bruns into branch 'master'.

kzip: Add various test cases

testZip64NestedStored: Verify KZip does not trip over the signatures of
the nested ZIP file, but only uses the signatures/headers of the outer
file.

testZip64NestedStoredStreamed: Verify KZip does not trip over the
signatures of the nested ZIP file, but only uses the signatures/headers
of the outer file. Currently fails, as data descriptors of the inner file
are taken instead of the outer ones.

testZip64EndOfCentralDirectory: Zip64 files may contain "Zip64 end
of central directory record"s, with signature "PK\6\6". Currently fails.

testZip64DataDescriptor: Zip64 data descriptors use 64 bit fields
for compressed and uncompressed size instead of the normal 32 bit fields,
thus the next record offset differs by 8 bytes. Currently fails.

The new files have been created with Info-ZIP `zip`:

> echo -ne "abcd" | zip zip64_end_of_central_directory.zip -

> echo -ne "abcd" | zip - - | cat > zip64_datadescriptor.zip
> zip - zip64_datadescriptor.zip zip64_end_of_central_directory.zip \
  | cat > zip64_nested_stored_streamed.zip
Related: bug 450597

A  +-    --    autotests/data/zip64_datadescriptor.zip
A  +-    --    autotests/data/zip64_end_of_central_directory.zip
A  +-    --    autotests/data/zip64_nested_stored_streamed.zip
M  +94   -0    autotests/karchivetest.cpp
M  +4    -0    autotests/karchivetest.h

https://invent.kde.org/frameworks/karchive/-/commit/ce749a2cb1bccc02f89cfe3536207d71b8cf0657
Comment 3 Bug Janitor Service 2025-03-30 19:09:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/karchive/-/merge_requests/110
Comment 4 Stefan Brüns 2025-03-30 20:08:23 UTC
Can you provide a test file? Or reevaluate yourself?
Comment 5 Stefan Brüns 2025-04-02 14:45:27 UTC
Git commit 2bf86d9d8e078513cc5d9f00d8e95544d9990d6c by Stefan Brüns.
Committed on 31/03/2025 at 20:04.
Pushed by bruns into branch 'master'.

Handle Zip64 extra field in central directory

Fix two problems with the current handling of size and relative header
offset in the Central Directory, when these have the special "invalid"
0xffffffff marker value:

- The "Local File Header" may also have "invalid" values for compressed/
  uncompressed size, i.e. when the sizes are recorded in a succeeding
  Data Descriptor.
  Use the Zip64 Extra field, which must be present in this case.
- The "Local Header Offset" in the "Central Directory" may be invalid
  as well, also use the Zip64 Extra field.

The fields in the Central Directory MAY also use the "invalid" value even
if case size and offset would fit in the 32 bit value, and always use the
Zip64 format.

Add two test files, the first exceeds 4 GByte uncompressed and requires
Zip64 format:
$> (echo -en abcd ; dd if=/dev/zero bs=1M count=4200 ; echo -en ABCD) \
  | zip - - | gzip -c - > zip64_extra_zip64_size.zip.gz

The second was created by Windows XPS virtual printer. It uses Zip64
fields although not necessary, all sizes/offsets are small.

A  +-    --    autotests/data/zip64_extra_zip64_localheader.oxps
A  +-    --    autotests/data/zip64_extra_zip64_size.zip.gz
M  +54   -0    autotests/karchivetest.cpp
M  +2    -0    autotests/karchivetest.h
M  +41   -44   src/kzip.cpp

https://invent.kde.org/frameworks/karchive/-/commit/2bf86d9d8e078513cc5d9f00d8e95544d9990d6c
Comment 6 Bug Janitor Service 2025-04-17 03:46:57 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Bug Janitor Service 2025-05-02 03:47:31 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.