Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@ -480,6 +480,61 @@ namespace MonoTests.System.IO.Compression
Assert.AreEqual(125387, byteCount);
}
[Test]
public void Issue10054_ZeroRead()
{
// "HelloWorld" as UTF8/DeflateStream(...,CompressionMode.Compress)
var buffer = new byte[] { 243, 72, 205, 201, 201, 15, 207, 47, 202, 73, 1, 0 };
var mem = new MemoryStream(buffer);
var chu = new ChunkedReader(mem);
var def = new DeflateStream(chu, CompressionMode.Decompress);
var buffer2 = new byte[4096];
int read2 = 0;
chu.limit = 3;
read2 += def.Read(buffer2, read2, buffer2.Length - read2);
chu.limit = 100;
read2 += def.Read(buffer2, read2, buffer2.Length - read2);
var res = Encoding.UTF8.GetString(buffer2, 0, read2);
Assert.AreEqual("HelloWorld", res);
}
public class ChunkedReader : Stream
{
public int limit = 0;
private Stream baseStream;
public ChunkedReader(Stream baseStream)
{
this.baseStream = baseStream;
}
public override int Read(byte[] buffer, int offset, int count)
{
int read = baseStream.Read(buffer, offset, Math.Min(count, this.limit));
this.limit -= read;
return read;
}
public override void Flush() => baseStream.Flush();
public override long Seek(long offset, SeekOrigin origin) => baseStream.Seek(offset, origin);
public override void SetLength(long value) => baseStream.SetLength(value);
public override void Write(byte[] buffer, int offset, int count) => baseStream.Write(buffer, offset, count);
public override bool CanRead => baseStream.CanRead;
public override bool CanSeek => baseStream.CanSeek;
public override bool CanWrite => baseStream.CanWrite;
public override long Length => baseStream.Length;
public override long Position
{
get => baseStream.Position;
set => baseStream.Position = value;
}
}
}
}

View File

@ -129,7 +129,7 @@ public class SslStreamTest {
} catch (ObjectDisposedException) { /* this can happen when closing connection it's irrelevant for the test result*/
} catch (IOException) {
// The authentication or decryption has failed.
// ---> Mono.Security.Protocol.Tls.TlsException: Insuficient Security
// ---> TlsException: Insuficient Security
// that's fine for MismatchedCipherSuites
if (!state.ServerIOException)
throw;

View File

@ -1 +1 @@
0fd53cdea741d804cf43f8d862815523224ef66f
0e5e4fa3cc55421e0c4f859790f4f9db6af83d40

View File

@ -315,7 +315,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
[Test]
public void RFC3280MandatoryAttributeTypes ()
{
string expected = "dnQualifier=CA, OID.2.5.4.5=345, S=Maryland, DC=testcertificates, DC=gov, O=Test Certificates, C=US";
string expected = "dnQualifier=CA, SERIALNUMBER=345, S=Maryland, DC=testcertificates, DC=gov, O=Test Certificates, C=US";
X509Certificate2 cert = new X509Certificate2 (RFC3280MandatoryAttributeTypesCACert_crt);
// note: strangely the (also CryptoAPI based) certificate viewer in Windows seems to resolve 2.5.4.5 as "Serial Number"
Assert.AreEqual (expected, cert.SubjectName.Name, "SubjectName");
@ -347,7 +347,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
0x13, 0x1D, 0x43, 0x56, 0x52, 0x3A, 0x31, 0x33, 0x34, 0x37, 0x31, 0x39, 0x36, 0x37, 0x2D, 0x55, 0x49, 0x44, 0x3A, 0x31, 0x32, 0x31,
0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32 };
X500DistinguishedName dn = new X500DistinguishedName (sn);
string subject = "OID.2.5.4.5=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK";
string subject = "SERIALNUMBER=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK";
Assert.AreEqual (subject, dn.Name, "Name");
}
}

View File

@ -454,6 +454,7 @@ mgk3bWUV6ChegutbguiKrI/DbO7wPiDLxw==
new X509Certificate ().GetSerialNumberString ();
}
#if !MOBILE
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void GetObjectData_Null ()
@ -474,6 +475,7 @@ mgk3bWUV6ChegutbguiKrI/DbO7wPiDLxw==
Assert.AreEqual (1, info.MemberCount, "MemberCount");
byte[] raw = (byte[]) info.GetValue ("RawData", typeof (byte[]));
}
#endif
[Test]
[ExpectedException (typeof (NullReferenceException))]

View File

@ -1 +1 @@
58b7b1819107b4116d60ac04a1f27d5b8af4a0d7
154d250723232cec39579047ce3ebd3ed2839f24