flanglet / kanzi-cpp

Fast lossless data compression in C++
Apache License 2.0
137 stars 3 forks source link

Blocksize integer overflow #7

Closed twekkel closed 2 years ago

twekkel commented 2 years ago

While 1G is the maximum documented blocksize...

$ echo "Block size" | kanzi -c -i stdin -t rolzx -b 1G -o stdout > block $ echo "Block size" | kanzi -c -i stdin -t rolzx -b 2G -o stdout > block Could not create the compressor: Minimum block size is 1 KB (1024 bytes), got -2147483648 bytes $ echo "Block size" | kanzi -c -i stdin -t rolzx -b 3G -o stdout > block Could not create the compressor: Minimum block size is 1 KB (1024 bytes), got -1073741824 bytes $ echo "Block size" | kanzi -c -i stdin -t rolzx -b 4G -o stdout > block Could not create the compressor: Minimum block size is 1 KB (1024 bytes), got 0 bytes $ echo "Block size" | kanzi -c -i stdin -t rolzx -b 5G -o stdout > block

sorry it is again not a compression related bug ;)

flanglet commented 2 years ago

Thanks for reporting this issue. I will push a fix shortly. Frankly, I'd better fix minor issues like these rather than complex and critical corner cases in multi-threaded (de)compression scenarios.

flanglet commented 2 years ago

Commit [b057b98]