From 57ff226a7b46296f1d7019f2dc06f82249e33db9 Mon Sep 17 00:00:00 2001 From: Andrew Hoefling Date: Wed, 6 Mar 2019 12:47:03 -0500 Subject: [PATCH] Removed (Int64) cast statements from RemoveItemsRange when checking for overflow errors Commit migrated from https://github.com/dotnet/coreclr/commit/39be7e55798e4f81c531661b0df798e91c7d5936 --- .../src/System/Collections/ObjectModel/Collection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs index 16939e4..8aa387b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs @@ -217,7 +217,7 @@ namespace System.Collections.ObjectModel ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if ((Int64)index + (Int64)count > items.Count) + if (index > items.Count - count) { ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen); } -- 2.7.4