Removed (Int64) cast statements from RemoveItemsRange when checking for overflow...
authorAndrew Hoefling <andrew@hoeflingsoftware.com>
Wed, 6 Mar 2019 17:47:03 +0000 (12:47 -0500)
committerSantiago Fernandez Madero <safern@microsoft.com>
Fri, 8 Mar 2019 19:20:58 +0000 (11:20 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/39be7e55798e4f81c531661b0df798e91c7d5936

src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs

index 16939e4..8aa387b 100644 (file)
@@ -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);
             }