[System.IO.Compression] Fixed DeflateStream inflate() decompression loop.
authorJoao Matos <joao@tritao.eu>
Thu, 27 Oct 2016 18:12:31 +0000 (19:12 +0100)
committerJoao Matos <joao@tritao.eu>
Thu, 27 Oct 2016 19:44:38 +0000 (20:44 +0100)
commit31f8da0b50460075bb381bcb0d9152cc231faba2
tree278bce2e25bd79960f2ba58e90cac101ab6dfa9f
parent86c24e94279f56d0426924fbb533f14d2c9b41a0
[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.
mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs
support/zlib-helper.c