2010-03-09 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 10 Mar 2010 04:46:25 +0000 (04:46 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 10 Mar 2010 04:46:25 +0000 (04:46 -0000)
* DeflateStream.cs: don't call unmanaged code when the byte count
is 0. Fixes bug #586870.

svn path=/trunk/mcs/; revision=153385

mcs/class/System/System.IO.Compression/ChangeLog
mcs/class/System/System.IO.Compression/DeflateStream.cs

index b1c585ef9bddd5e8522f080a0de2de831ac2c5f6..1ff7bf7edd20f91f42c672d8f8ca5d5137e31cdc 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-09 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * DeflateStream.cs: don't call unmanaged code when the byte count
+       is 0. Fixes bug #586870.
+
 2009-12-23  Geoff Norton  <gnorton@novell.com>
 
        * DeflateStream.cs: Ensure our callbacks go into the correct
index 53fc3b189c1d14b11a216b1333f885adf267d675..b83ca4c486da965bac17aa4968a33310a1070840 100644 (file)
@@ -183,6 +183,9 @@ namespace System.IO.Compression {
 
                unsafe int ReadInternal (byte[] array, int offset, int count)
                {
+                       if (count == 0)
+                               return 0;
+
                        int result = 0;
                        fixed (byte *b = array) {
                                IntPtr ptr = new IntPtr (b + offset);
@@ -213,6 +216,9 @@ namespace System.IO.Compression {
 
                unsafe void WriteInternal (byte[] array, int offset, int count)
                {
+                       if (count == 0)
+                               return;
+
                        int result = 0;
                        fixed (byte *b = array) {
                                IntPtr ptr = new IntPtr (b + offset);