Pierre Neidhardt wrote:
If you write incomplete data (maybe because the file is truncated), and
then call LZ_decompress_read until it returns 0 (without calling
LZ_(de)compress_finish nor reading until LZ_(de)compress_finished
returns 1), then the decompressed data produced will be also truncated.
No error is reported because the decoder is waiting more input.
And that's fine since the input is a stream, isn't it?
So when I'm done with the stream, all the data has been written/read,
then the compressed data will be complete, right? Calling
LZ_(de)compress_finish then should not change anything, or will it?
You have two problems here:
For decompression the problem is that your code is not robust. If you
don't do it the right way and your assumption that "the input is a
stream" happens to be false, then your code will silently cause data loss.
For compression, if you don't call LZ_compress_finish or do not read
until LZ_compress_finished returns 1, you'll produce a truncated stream
which, BTW, won't be detected as truncated by your non-robust
decompression code.
_______________________________________________
Lzip-bug mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lzip-bug