[Top][All Lists]

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

Re: [Lzip-bug] How to reset a LZ_Decoder

From: Antonio Diaz Diaz
Subject: Re: [Lzip-bug] How to reset a LZ_Decoder
Date: Sat, 19 Dec 2009 19:56:20 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Jacob Rief wrote:
Resetting the internal flags to a state equivalent to a decoder just after
creation can't work. Suppose the next header has not been yet fed to
LZ_decompress_write. You'll have to switch to a "search" state, then write
data until the header is found.

I assumed that the API client already forwarded its steam to the
beginning of the next member, which means that the first bytes written
using LZ_decompress_write(decoder, ...) are 'LZIP...'. That's the way
I did it for now.

This would unnecessarily skip a whole member if the next header has been already written with LZ_decompress_write and the error happens before the decoder reads the header from the internal buffer.

Same if the header has been partially written with LZ_decompress_write.

It seems to me that switching to a "search" state, writing data, and letting the decoder find the header is the safest approach.


reply via email to

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