cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 5 Feb 2005 23:35:32 +0100 (CET)

Forwarding this mail to the (more proper) libcurl list.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
---------- Forwarded message ----------
Date: Sat, 5 Feb 2005 11:17:14 +0800
From: Maruko
To: curl-users_at_cool.haxx.se
Subject: A possible bug in function inflate_stream (content_encoding.c)?
Hi,
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?
Best regards,
maruko
Received on 2005-02-05