cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: A possible bug in function inflate_stream (content_encoding.c)? (fwd)

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sun, 6 Feb 2005 20:29:13 -0800

> When I test libcurl + HTTP protocol today, I found it failed to
> download a 64KB file. In function inflate_stream (content_encoding.c),
> the call to inflate() returns Z_BUF_ERROR.
>
> I noticed that 64KB is just the size of the decompress buffer. When
> downloading a 64KB file, the decompress buffer is all used, so
> z->avail_out will be 0, in this case, the statement below does not
> work correctly:
>
> /* Done with these bytes, exit */
> if (status == Z_OK && z->avail_in == 0 && z->avail_out > 0)
> ^ ^ ^ ^
> ^ ^ ^ ^ ^ ^
> I think the condition z->avail_out > 0 should be removed.
>
> Any ideas?

I wasn't able to reproduce this problem with zlib ver. 1.1.4, but it could
very well be due to different behaviour in ver. 1.2. I agree with this
suggested fix--I can't see how the size of the avail_out buffer is relevant
to whether the function should exit or not at that point.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2005-02-07