Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoao Matos <joao@tritao.eu>2016-10-27 21:12:31 +0300
committerJoao Matos <joao@tritao.eu>2016-10-27 22:44:38 +0300
commit31f8da0b50460075bb381bcb0d9152cc231faba2 (patch)
tree278bce2e25bd79960f2ba58e90cac101ab6dfa9f /support
parent86c24e94279f56d0426924fbb533f14d2c9b41a0 (diff)
[System.IO.Compression] Fixed DeflateStream inflate() decompression loop.
This reworks the fix from https://github.com/mono/mono/commit/7c4d41a518aaf0370b882f9430752ebcd5544c10. That fix introduced a regression when handling some inputs, which lead us to ignore some left-over data from zlib's inflate output buffer. Now we only break from the loop if inflate() returns Z_BUF_ERROR. This makes sure all data is fully processed before returning to managed code. Fixes one of the bugs in https://bugzilla.xamarin.com/show_bug.cgi?id=44994#c2.
Diffstat (limited to 'support')
-rw-r--r--support/zlib-helper.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/support/zlib-helper.c b/support/zlib-helper.c
index f364a66095f..5e07a2e21ce 100644
--- a/support/zlib-helper.c
+++ b/support/zlib-helper.c
@@ -202,13 +202,16 @@ ReadZStream (ZStream *stream, guchar *buffer, gint length)
zs->avail_in = n < 0 ? 0 : n;
}
- if (zs->avail_in == 0 && (zs->total_in == 0 || stream->total_in == zs->total_in))
- return Z_STREAM_END;
+ if (zs->avail_in == 0 && zs->total_in == 0)
+ return 0;
status = inflate (stream->stream, Z_SYNC_FLUSH);
if (status == Z_STREAM_END) {
stream->eof = TRUE;
break;
+ } else if (status == Z_BUF_ERROR && stream->total_in == zs->total_in) {
+ stream->eof = TRUE;
+ break;
} else if (status != Z_OK) {
return status;
}