lzip-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lzip-bug] [lzlib] Help with Scheme bindings (for GNU Guix)


From: Antonio Diaz Diaz
Subject: Re: [Lzip-bug] [lzlib] Help with Scheme bindings (for GNU Guix)
Date: Wed, 24 Apr 2019 17:34:48 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]