Browse Source

Fix overflow checking in PLinq Range operator

Jérémie Laval 15 years ago
parent
commit
beddbef60a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      mcs/class/System.Core/System.Linq/ParallelEnumerable.cs

+ 1 - 1
mcs/class/System.Core/System.Linq/ParallelEnumerable.cs

@@ -40,7 +40,7 @@ namespace System.Linq
 		#region Range & Repeat
 		public static ParallelQuery<int> Range (int start, int count)
 		{
-			if (int.MaxValue - start < count)
+			if (int.MaxValue - start < count - 1)
 				throw new ArgumentOutOfRangeException ("count", "start + count - 1 is larger than Int32.MaxValue");
 			if (count < 0)
 				throw new ArgumentOutOfRangeException ("count", "count is less than 0");