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

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Aug 4 14:47:26 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 marek.safar at seznam.cz.

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

--- shadow/81956	2007-08-02 15:13:06.000000000 -0400
+++ shadow/81956.tmp.30817	2007-08-04 14:47:26.000000000 -0400
@@ -420,6 +420,41 @@
 Can you provide a stack trace of the error from your test case ?
 
 One possibility is that MS runtime expects special syntax of byte
 array initializer (csc produces __StaticArrayInitTypeSize=<<size>>) to
 work correctly. It's just guess because I cannot test it, it works on
 my machine.
+
+------- Additional Comments From marek.safar at seznam.cz  2007-08-04 14:47 -------
+OK, It looks better now. I was able to reproduce the issue with the
+compiled sample which you sent me.
+
+I got errors like this
+
+System.AccessViolationException: Attempted to read or write protected
+memory. This is often an indication that other memory is corrupt.
+   at Mono.Math.BigInteger.Kernel.SquarePositive(BigInteger bi,
+UInt32[]& wkSpace)
+   at Mono.Math.BigInteger.ModulusRing.OddPow(BigInteger b, BigInteger
+exp)
+   at Mono.Math.BigInteger.ModPow(BigInteger exp, BigInteger n)
+   at Foo.Calculator.Calculate()
+
+
+Which indicates that the problem is in BigInteger class. I also
+recompiled the test sample with csc and I got same exception.
+
+I check BigInteger class and I think I found the problem.
+
+public static unsafe void SquarePositive (BigInteger bi, ref uint []
+wkSpace)
+{
+	uint [] t = wkSpace;
+	wkSpace = bi.data;
+	uint [] d = bi.data;
+	uint dl = bi.length;
+	bi.data = t;  <<<< HERE
+
+I think this code is not thread safe, bi is shared and it is modified
+by each thread.
+
+


More information about the mono-bugs mailing list