// (C) 2004 Novell, Inc. <http://www.novell.com>
//
-#if NET_2_0
using NUnit.Framework;
using System;
decompressing.Close();
}
+ // https://bugzilla.xamarin.com/show_bug.cgi?id=22346
+ [Test]
+ public void CheckEmptyRead ()
+ {
+ byte [] dummy = new byte[1];
+ byte [] data = new byte[0];
+ MemoryStream backing = new MemoryStream (data);
+ DeflateStream compressing = new DeflateStream (backing, CompressionMode.Decompress);
+ compressing.Read (dummy, 0, 1);
+ }
+
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void CheckNullRead ()
backing.Close();
}
#endif
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void CheckBufferOverrun ()
+ {
+ byte[] data = new byte [20];
+ MemoryStream backing = new MemoryStream ();
+ DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
+ compressing.Write (data, 0, data.Length + 1);
+ compressing.Close ();
+ backing.Close ();
+ }
}
}
-#endif