[Mono-dev] Possible Bug in BigInteger.Multiply

Neale Ferguson neale at sinenomine.net
Fri Dec 30 13:01:15 EST 2005

I've been having build problems with my 64-bit s390 system. I've tracked it down to what I believe is a bug in BigInteger.Multiply that is overwriting a BigInteger field and corrupting the .data.Length field of the object. Multiply is being called from OddPow. The error manifests itself in SquarePositive when the bounds check for the array is performed: 

Unhandled Exception: System.IndexOutOfRangeException: Array index is out of range.
in <0x00094> Mono.Math.BigInteger+Kernel:SquarePositive (Mono.Math.BigInteger bi, System.UInt32[] wkSpace)
in <0x00900> Mono.Math.BigInteger+ModulusRing:OddPow (Mono.Math.BigInteger b, Mono.Math.BigInteger exp)
in <0x00092> Mono.Math.BigInteger+ModulusRing:Pow (Mono.Math.BigInteger b, Mono.Math.BigInteger exp)
in <0x000be> Mono.Math.BigInteger:ModPow (Mono.Math.BigInteger exp, Mono.Math.BigInteger n)
in <0x0026c> Mono.Security.Cryptography.RSAManaged:DecryptValue (System.Byte[] rgb)
in <0x00086> System.Security.Cryptography.RSACryptoServiceProvider:DecryptValue (System.Byte[] rgb)
in <0x0003e> Mono.Security.Cryptography.PKCS1:RSASP1 (System.Security.Cryptography.RSA rsa, System.Byte[] m)
in <0x000ee> Mono.Security.Cryptography.PKCS1:Sign_v15 (System.Security.Cryptography.RSA rsa, System.Security.Cryptography.HashAlgorithm hash, System.Byte[] hashValue)
in <0x0009c> System.Security.Cryptography.RSAPKCS1SignatureFormatter:CreateSignature (System.Byte[] rgbHash)
in <0x00278> Mono.Security.StrongName:Sign (System.String fileName)
in <0x002f2> Mono.Tools.SN:ReSign (System.String assemblyName, System.Security.Cryptography.RSA key)
in <0x0175c> Mono.Tools.SN:Main (System.String[] args)

The bug is described at http://pastebin.com/484359 with background information at http://pastebin.com/484243.


More information about the Mono-devel-list mailing list