From 8c310cd65d8bd97359765ff83811b222ef922a13 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 25 Sep 2018 16:58:20 -0700 Subject: [PATCH] Add regression test. Commit migrated from https://github.com/dotnet/coreclr/commit/9864e50091aebb4c0c5cca873d94e71f0dd84207 --- .../Regressions/coreclr/GitHub_7829/test7829.cs | 44 ++++++++++++++++++++++ .../coreclr/GitHub_7829/test7829.csproj | 41 ++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.cs create mode 100644 src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.csproj diff --git a/src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.cs b/src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.cs new file mode 100644 index 0000000..12a68a2 --- /dev/null +++ b/src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +// Repro case for CoreCLR 7829 + +class X +{ + private class Buffer : SafeBuffer + { + public Buffer() + : base (false) + { + + } + + protected override bool ReleaseHandle() + { + return true; + } + } + + public static int Main() + { + var buffer = new Buffer(); + + try + { + buffer.Initialize(uint.MaxValue - 1, uint.MaxValue - 1); + } + catch (ArgumentOutOfRangeException) + { + return 100; + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + return 101; + } +} diff --git a/src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.csproj b/src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.csproj new file mode 100644 index 0000000..cfe6d36 --- /dev/null +++ b/src/coreclr/tests/src/Regressions/coreclr/GitHub_7829/test7829.csproj @@ -0,0 +1,41 @@ + + + + + Debug + AnyCPU + 2.0 + {E55A6F8B-B9E3-45CE-88F4-22AE70F606CB} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + BuildAndRun + + + + + + + + + False + + + + + True + + + + + + + + + + + + + + -- 2.7.4