From: Michal Strehovský Date: Tue, 26 Jun 2018 14:17:53 +0000 (+0200) Subject: Fix bogus assert in ArraySortHelper (dotnet/corertdotnet/coreclr#6018) X-Git-Tag: submit/tizen/20210909.063632~11030^2~4510 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b17d072fc6acad54c5a526b9cddc18cf517313ce;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix bogus assert in ArraySortHelper (dotnet/corertdotnet/coreclr#6018) Fixes dotnet/coreclr#6016. Resolves dotnet/coreclr#6015. Signed-off-by: dotnet-bot Commit migrated from https://github.com/dotnet/coreclr/commit/bcabe118b783feb489c791e340f1c3ea792acde2 --- diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs index b717bd7..03b9865 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs @@ -654,10 +654,10 @@ namespace System.Collections.Generic private static void SwapIfGreaterWithItems(TKey[] keys, TValue[] values, IComparer 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) {