From fb2546951c7f2a3a20da5bd03661e8cf0396c32a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 12 Jul 2013 14:05:55 -0400 Subject: [PATCH] Prevent potential integer overflows in SortedList's binary search midpoint calculation --- mcs/class/System/System.Collections.Generic/SortedList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcs/class/System/System.Collections.Generic/SortedList.cs b/mcs/class/System/System.Collections.Generic/SortedList.cs index c1190b2ad26..2eaec862bda 100644 --- a/mcs/class/System/System.Collections.Generic/SortedList.cs +++ b/mcs/class/System/System.Collections.Generic/SortedList.cs @@ -629,7 +629,7 @@ namespace System.Collections.Generic int right = len-1; while (left <= right) { - int guess = (left + right) >> 1; + int guess = left + ((right - left) >> 1); int cmp = Compare (table[guess].Key, key); if (cmp == 0) return guess; -- 2.25.1