diff options
author | Gabriel Garcia <garciat@live.com> | 2015-04-06 20:59:43 +0300 |
---|---|---|
committer | Gabriel Garcia <garciat@live.com> | 2015-04-07 13:22:32 +0300 |
commit | 2dcdfe76d02fed91b71e5b49b6028c6c82e10d4c (patch) | |
tree | c7b2ae41e98c60e8b6df699d550329c4123a3558 /support | |
parent | 3ea808102c18a61ee1616f04d4403300729d5e49 (diff) |
[System] Fix DeflateStream throw on empty flush, double flush. Fixes #28777
Diffstat (limited to 'support')
-rw-r--r-- | support/zlib-helper.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/support/zlib-helper.c b/support/zlib-helper.c index 83455413b36..38696260a09 100644 --- a/support/zlib-helper.c +++ b/support/zlib-helper.c @@ -90,6 +90,8 @@ CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle) result->gchandle = gchandle; result->compress = compress; result->buffer = g_new (guchar, BUFFER_SIZE); + result->stream->next_out = result->buffer; + result->stream->avail_out = BUFFER_SIZE; return result; } @@ -148,7 +150,7 @@ flush_internal (ZStream *stream, gboolean is_final) if (!stream->compress) return 0; - if (!is_final) { + if (!is_final && stream->stream->avail_in != 0) { status = deflate (stream->stream, Z_PARTIAL_FLUSH); if (status != Z_OK && status != Z_STREAM_END) return status; |