[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 61/116: content_encoding: fix inflate_stream for no
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 61/116: content_encoding: fix inflate_stream for no bytes available |
Date: |
Tue, 05 Dec 2017 14:51:31 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit fa64b0fc4bb8e25fd831db8b9328eeec5cc209c1
Author: Jay Satiro <address@hidden>
AuthorDate: Tue Nov 7 00:46:59 2017 -0500
content_encoding: fix inflate_stream for no bytes available
- Don't call zlib's inflate() when avail_in stream bytes is 0.
This is a follow up to the parent commit 19e66e5. Prior to that change
libcurl's inflate_stream could call zlib's inflate even when no bytes
were available, causing inflate to return Z_BUF_ERROR, and then
inflate_stream would treat that as a hard error and return
CURLE_BAD_CONTENT_ENCODING.
According to the zlib FAQ, Z_BUF_ERROR is not fatal.
This bug would happen randomly since packet sizes are arbitrary. A test
of 10,000 transfers had 55 fail (ie 0.55%).
Ref: https://zlib.net/zlib_faq.html#faq05
Closes https://github.com/curl/curl/pull/2060
---
lib/content_encoding.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/content_encoding.c b/lib/content_encoding.c
index 904dff526..626bb8ec9 100644
--- a/lib/content_encoding.c
+++ b/lib/content_encoding.c
@@ -139,6 +139,11 @@ inflate_stream(struct connectdata *conn, contenc_writer
*writer)
/* because the buffer size is fixed, iteratively decompress and transfer to
the client via client_write. */
for(;;) {
+ if(z->avail_in == 0) {
+ free(decomp);
+ return result;
+ }
+
/* (re)set buffer for decompressed output for every iteration */
z->next_out = (Bytef *) decomp;
z->avail_out = DSIZ;
@@ -163,10 +168,7 @@ inflate_stream(struct connectdata *conn, contenc_writer
*writer)
/* Done with these bytes, exit */
/* status is always Z_OK at this point! */
- if(z->avail_in == 0) {
- free(decomp);
- return result;
- }
+ continue;
}
else if(allow_restart && status == Z_DATA_ERROR) {
/* some servers seem to not generate zlib headers, so this is an attempt
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 29/116: timeleft: made two more users of Curl_timeleft use timediff_t, (continued)
- [GNUnet-SVN] [gnurl] 29/116: timeleft: made two more users of Curl_timeleft use timediff_t, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 46/116: CURLOPT_INFILESIZE: accept -1, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 23/116: ROADMAP: cleanup, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 07/116: ftplistparser: free off temporary memory always, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 54/116: Makefile.m32: add brotli support, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 20/116: appveyor: add a win32 build, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 09/116: time: rename Curl_tvnow to Curl_now, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 28/116: cmake: Export libcurl and curl targets to use by other cmake projects, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 59/116: fnmatch: remove dead code, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 44/116: http2: Fixed OOM handling in upgrade request, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 61/116: content_encoding: fix inflate_stream for no bytes available,
gnunet <=
- [GNUnet-SVN] [gnurl] 51/116: url: remove arg value check from CURLOPT_SSH_AUTH_TYPES, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 33/116: INTERNALS: remove curlx_tv* functions no longer provided, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 62/116: curl_multi_fdset.3: emphasize curl_multi_timeout, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 39/116: cookie: avoid NULL dereference, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 41/116: include: remove conncache.h inclusion from where its not needed, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 56/116: Makefile.m32: allow to customize brotli libs, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 64/116: imap: deal with commands case insensitively, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 34/116: select: update comments, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 31/116: cli tool: improve "; type=" handling in -F option arguments, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 53/116: HTTP: implement Brotli content encoding, gnunet, 2017/12/05