Fix bogus assert in ArraySortHelper (dotnet/corertdotnet/coreclr#6018)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Tue, 26 Jun 2018 14:17:53 +0000 (16:17 +0200)
committerJan Kotas <jkotas@microsoft.com>
Wed, 27 Jun 2018 00:22:02 +0000 (17:22 -0700)
Fixes dotnet/coreclr#6016.
Resolves dotnet/coreclr#6015.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/bcabe118b783feb489c791e340f1c3ea792acde2

src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs

index b717bd7..03b9865 100644 (file)
@@ -654,10 +654,10 @@ namespace System.Collections.Generic
         private static void SwapIfGreaterWithItems(TKey[] keys, TValue[] values, IComparer<TKey> comparer, int a, int b)
         {
             Debug.Assert(keys != null);
-            Debug.Assert(values != null && values.Length >= keys.Length);
+            Debug.Assert(values != null);
             Debug.Assert(comparer != null);
-            Debug.Assert(0 <= a && a < keys.Length);
-            Debug.Assert(0 <= b && b < keys.Length);
+            Debug.Assert(0 <= a && a < keys.Length && a < values.Length);
+            Debug.Assert(0 <= b && b < keys.Length && b < values.Length);
 
             if (a != b)
             {