Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82469 --- shadow/82469 2007-08-17 11:24:48.000000000 -0400 +++ shadow/82469.tmp.23635 2007-08-17 11:24:48.000000000 -0400 @@ -0,0 +1,49 @@ +Bug#: 82469 +Product: Mono: Class Libraries +Version: unspecified +OS: other +OS Details: suse 10.1 +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: System +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: System.Array.BinarySearch is broken for large values + +Description of Problem: +System.Array.BinarySearch throws System.InvalidOperationException if the +array is large. This is caused by overflow in the calculation: + + mid = (bot + top) / 2 + + +Steps to reproduce the problem: +1. Execute this code: + 1: int ind = 0; + 2: byte[] array = new byte[1100000000]; + 3: array[array.Length - 1] = 1; + 4: ind = System.Array.BinarySearch(array,1); + 5: if (ind!=0) + 6: Console.WriteLine("found " + ind); + 7: else Console.WriteLine("not found"); + +Actual Results: +System.InvalidOperationException while executing line 4 + +Expected Results: +Successful execution of line: + 6: Console.WriteLine("found " + ind); + +How often does this happen? +Every time + +Additional Information: +one of the ways to fix it substitute line with division: + + mid = bot + ((top - bot) / 2); _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
