Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault with small files with levels 5+ #22

Open
inikep opened this issue Mar 13, 2025 · 4 comments
Open

Segmentation fault with small files with levels 5+ #22

inikep opened this issue Mar 13, 2025 · 4 comments

Comments

@inikep
Copy link

inikep commented Mar 13, 2025

Kanzi fails in decompression in lzbench using level 5 or above with the following files:
https://github.com/inikep/lzbench/blob/master/lz/xz/ChangeLog (255 Bytes)
https://github.com/inikep/lzbench/blob/master/lz/zlib/zlib.pc.in (254 Bytes)

./lzbench -t0,0 -ekanzi,5 zlib/zlib.pc.in
lzbench 2.0.1 (64-bit Linux)  AMD EPYC 9554 64-Core Processor                

Compressor name         Compress. Decompress. Compr. size  Ratio Filename
memcpy                   5291 MB/s  5521 MB/s         254 100.00 zlib/zlib.pc.in
Segmentation fault (core dumped)
./lzbench -t0,0 -ekanzi,5 xz/ChangeLog
lzbench 2.0.1 (64-bit Linux)  AMD EPYC 9554 64-Core Processor                

Compressor name         Compress. Decompress. Compr. size  Ratio Filename
memcpy                   5204 MB/s  5543 MB/s         255 100.00 xz/ChangeLog
Segmentation fault (core dumped)
@flanglet
Copy link
Owner

flanglet commented Mar 14, 2025

Outside of lzbench, I do not get a segfault but the decompression fails both with kanzi 2.3 and at tip. Clearly a bug. Thanks for reporting. The issue only affects the BWT inverse (levels 5, 6, 7) and files just close to 255 bytes in size.

@flanglet
Copy link
Owner

Fixed at tip in flanglet/kanzi-cpp@68b14b8.

@inikep
Copy link
Author

inikep commented Mar 15, 2025

This fix is not applicable to v2.3.0 at https://github.com/flanglet/kanzi-cpp/blob/2.3.0/src/transform/BWTBlockCodec.cpp

@flanglet
Copy link
Owner

The easiest way to fix 2.3 is to copy over the new version of BWTBlockCodec and patch line 102 with "if (true)". Patching 2.3 directly is more involved. Otherwise, wait for 2.4 which is going to be out in a couple of months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants