Bug 17183 - System.IO.Compression.DeflateStream gives incorrect data after compress/decompress cycle
Summary: System.IO.Compression.DeflateStream gives incorrect data after compress/decom...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 3.2.x
Hardware: Other Linux
: Normal normal
Target Milestone: Untriaged
Assignee: João Matos
URL:
Depends on:
Blocks:
 
Reported: 2014-01-10 20:47 UTC by Eric Roller
Modified: 2014-02-13 17:15 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
zip of binary data and source code (112.18 KB, application/x-zip-compressed)
2014-01-10 20:47 UTC, Eric Roller
Details
source code (2.92 KB, text/plain)
2014-01-10 20:51 UTC, Eric Roller
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Eric Roller 2014-01-10 20:47:15 UTC
Created attachment 5814 [details]
zip of binary data and source code

Description of Problem:
Mono produces incorrect byte[] after compressing and then decompressing data when using DeflateStream class.

Steps to reproduce the problem:
1. Download and extract attached zip file with binary data and source code
2. compile source (mcs Program.cs)
3. run it (mono Program.exe)

Actual Results:
Uncompressed byte[] length is 1114216 with MD5 sum 2f02fea1ade220522b43097d9331f503
Compressed byte[] length is 119428 with MD5 sum 5e5be1cb365ebdb5ac82c7544fecb2dd
Decompressed byte[] length is 1114112 with MD5 sum e397c8fa8fdc3c15b6ed9a393a833928


Expected Results:
Uncompressed byte[] length is 1114216 with MD5 sum 2f02fea1ade220522b43097d9331f503
Compressed byte[] length is 119428 with MD5 sum 5e5be1cb365ebdb5ac82c7544fecb2dd
Decompressed byte[] length is 1114216 with MD5 sum 2f02fea1ade220522b43097d9331f503

How often does this happen? 
-always for this particular byte[] under linux (tested mono 2.10 up to 3.2.3)
-never on .NET
Comment 1 Eric Roller 2014-01-10 20:51:11 UTC
Created attachment 5815 [details]
source code
Comment 2 João Matos 2014-02-13 16:58:35 UTC
Hi Eric,

Thanks for reporting the bug and providing a clear test case.

I've pushed a fix for this problem: https://github.com/mono/mono/commit/eefbe2d246fc38e422390ac370f8b5d7efcc4236
Comment 3 Eric Roller 2014-02-13 17:15:47 UTC
Thanks João! Glad it was a simple one line fix.