Bug 509201 - KArchive fails to extract 7z archives that use the BCJ2 filter.
Summary: KArchive fails to extract 7z archives that use the BCJ2 filter.
Status: REPORTED
Alias: None
Product: frameworks-karchive
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-06 17:16 UTC by Azhar Momin
Modified: 2025-09-06 17:22 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Azhar Momin 2025-09-06 17:16:01 UTC
SUMMARY

KArchive fails to extract 7z archives that use the BCJ2 filter.

STEPS TO REPRODUCE
1. Create a test archive with BCJ2:
   `7z a archive.7z /usr/bin/ls -m0=BCJ2 -m1=LZMA2 -m2=LZMA2 -m3=LZMA2`
2. Attempt to extract using KArchive:
   `archive.directory()->copyTo()`
3. Extraction fails with an assertion error:
./build/karchivetest archive.7z
ASSERT: "n == currentChunkSize" in /home/azhar/Projects/KArchive/src/karchive.cpp, line 871
[1] 10321 IOT instruction (core dumped) ./build/karchivetest archive.7z`

OBSERVED RESULT
Extraction fails with assertion error.

EXPECTED RESULT
Archive should extract successfully.

SOFTWARE/OS VERSIONS
Distro: openSUSE Tumbleweed 20250820
KDE Plasma: 6.4.4
KDE Frameworks: 6.17.0
Qt: 6.9.2
Comment 1 Azhar Momin 2025-09-06 17:22:03 UTC
Another problem I observed: when creating a 7z archive with the BCJ2 filter using small text content (instead of a binary), extraction does not crash but produces an incomplete file with extra garbage data prepended, this may or may not be the same problem:

➜  Testing echo 'Hello, World!' | 7z a 7z_coder_test_bcj2.7z -m0=bcj2 -m1=lzma2 -m2=lzma2 -m3=lzma2 -sihello.txt

7-Zip (z) 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29
 64-bit locale=en_US.UTF-8 Threads:8 OPEN_MAX:524288, ASM

Creating archive: 7z_coder_test_bcj2.7z

Add new data to archive: 1 file


Files read from disk: 1
Archive size: 185 bytes (1 KiB)
Everything is Ok
➜  Testing ./build/karchivetest 7z_coder_test_bcj2.7z
Archive directory copied successfully
➜  Testing xxd out/hello.txt
00000000: 0100 1101 000d 4865 6c6c 6f2c 2057       ......Hello, W