[Mono-bugs] [Bug 81956][Wis] Changed - ArrayOutOfBounds in BigInteger class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 4 09:01:29 EDT 2007


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 sebastien at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81956

--- shadow/81956	2007-06-29 01:19:19.000000000 -0400
+++ shadow/81956.tmp.21921	2007-07-04 09:01:29.000000000 -0400
@@ -1,12 +1,12 @@
 Bug#: 81956
 Product: Mono: Class Libraries
 Version: 1.2
 OS: unknown
 OS Details: 
-Status: NEW   
+Status: ASSIGNED   
 Resolution: 
 Severity: Unknown
 Priority: Wishlist
 Component: Mono.Security
 AssignedTo: sebastien at ximian.com                            
 ReportedBy: alan.mcgovern at gmail.com               
@@ -225,6 +225,141 @@
 
 Here are two (slightly different) testcases. Both run fine on mono,
 both die horribly on MS.NET.
 
 http://monoport.com/3500
 http://monoport.com/3501
+
+------- Additional Comments From sebastien at ximian.com  2007-07-04 09:01 -------
+Please never use monoport/pastebin or any other remote source to
+_attach_ stuff to a bug report.
+
+------------------
+
+using Mono.Math;
+using System.Threading;
+using System;
+
+class Foo
+{
+	private class Calculator
+        {
+            static BigInteger a;
+            static BigInteger b;
+            static BigInteger prime;
+
+            static Calculator()
+            {
+                a =
+BigInteger.Parse("1505778177850948193710646556683821540721977879292014079862893403596323542752005465584270551016994129419693809808055196483547488078132201447066538900759073912922768432567519189511369447574678154606261886226850691181193737850245824867");
+                b =
+BigInteger.Parse("677945009437120105694669798094511858617540659626");
+                prime = new Mono.Math.BigInteger(new byte[] { 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0xF, 0xDA, 0xA2, 0x21,
+0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
+0x29, 0x2, 0x4E, 0x8, 0x8A, 0x67, 0xCC, 0x74, 0x2, 0xB, 0xBE, 0xA6,
+0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x8, 0x79, 0x8E, 0x34, 0x4, 0xDD,
+0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0xA, 0x6D,
+0xF2, 0x5F, 0x14, 0x37, 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2,
+0x45, 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, 0xF4, 0x4C,
+0x42, 0xE9, 0xA6, 0x3A, 0x36, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x5,
+0x63 });
+            }
+            public void Calculate()
+            {
+                try
+                {
+                    while (true)
+                        new BigInteger(a.GetBytes()).ModPow(new
+BigInteger(b.GetBytes()), new BigInteger(prime.GetBytes()));
+                }
+                catch
+                {
+                    Console.WriteLine("AAAGH");
+                }
+            }
+        }
+
+        static void Main(string[] args)
+        {
+            new Thread(new ThreadStart(new
+Calculator().Calculate)).Start();
+            new Thread(new ThreadStart(new
+Calculator().Calculate)).Start();
+            new Thread(new ThreadStart(new
+Calculator().Calculate)).Start();
+            new Thread(new ThreadStart(new
+Calculator().Calculate)).Start();
+            new Thread(new ThreadStart(new
+Calculator().Calculate)).Start();
+            new Thread(new ThreadStart(new
+Calculator().Calculate)).Start();
+
+            while (true)
+            {
+                System.Threading.Thread.Sleep(50);
+            }
+            return;
+      }
+}
+
+------------------------
+
+using Mono.Math;
+using System.Threading;
+using System;
+
+class Foo
+{
+    public class Calculator
+    {
+        BigInteger a;
+        BigInteger b;
+        BigInteger prime;
+
+        public Calculator()
+        {
+            a =
+BigInteger.Parse("1505778177850948193710646556683821540721977879292014079862893403596323542752005465584270551016994129419693809808055196483547488078132201447066538900759073912922768432567519189511369447574678154606261886226850691181193737850245824867");
+            b =
+BigInteger.Parse("677945009437120105694669798094511858617540659626");
+            prime = new Mono.Math.BigInteger(new byte[] { 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0xF, 0xDA, 0xA2, 0x21, 0x68,
+0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, 0x29, 0x2,
+0x4E, 0x8, 0x8A, 0x67, 0xCC, 0x74, 0x2, 0xB, 0xBE, 0xA6, 0x3B, 0x13,
+0x9B, 0x22, 0x51, 0x4A, 0x8, 0x79, 0x8E, 0x34, 0x4, 0xDD, 0xEF, 0x95,
+0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0xA, 0x6D, 0xF2, 0x5F,
+0x14, 0x37, 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, 0xE4,
+0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, 0xF4, 0x4C, 0x42, 0xE9,
+0xA6, 0x3A, 0x36, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x5, 0x63 });
+        }
+        public void Calculate()
+        {
+            try
+            {
+                while (true)
+                    a.ModPow(b, prime);
+            }
+            catch(Exception ex)
+            {
+                Console.WriteLine(ex.ToString());
+            }
+        }
+    }
+
+    static void Main(string[] args)
+    {
+        new Thread(new ThreadStart(new Calculator().Calculate)).Start();
+        new Thread(new ThreadStart(new Calculator().Calculate)).Start();
+        new Thread(new ThreadStart(new Calculator().Calculate)).Start();
+        new Thread(new ThreadStart(new Calculator().Calculate)).Start();
+        new Thread(new ThreadStart(new Calculator().Calculate)).Start();
+        new Thread(new ThreadStart(new Calculator().Calculate)).Start();
+
+        while (true)
+        {
+            System.Threading.Thread.Sleep(50);
+        }
+        return;
+    }
+}
+


More information about the mono-bugs mailing list