rakuten / as3crypto

Automatically exported from code.google.com/p/as3crypto
0 stars 1 forks source link

toString(10) in a BigInteger enters an infinite loop #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create an instance of BigInteger (for example var foo:BigInteger = new
BigInteger("50"); )

2. Try to retrieve its string value in decimal ( foo.toString(10); )

What is the expected output? 
return "50" (as a string)

What do you see instead?
The flash player enters an infinite loop.

What version of the product are you using? On what operating system?
Trunk (revision 28) / Windows

Please provide any additional information below.
I saw this in the source code of com.hurlant.math.BigInteger (line 72) :

public function toString(radix:Number=16):String {
    if (s<0) return "-"+negate().toString(radix);
    var k:int;
    switch (radix) {
        case 2:   k=1; break;
        case 4:   k=2; break;
        case 8:   k=3; break;
        case 16:  k=4; break;
        case 32:  k=5; break;
        default:
//          return toRadix(radix);
    }

Why is the default statement (line 82) commented ? (when I uncomment this
line, it works and I have the expected value)

toRadix() is protected and only used in toString(), that means currently
toRadix() is never called...

Original issue reported on code.google.com by jerome.a...@gmail.com on 15 Feb 2010 at 11:34

GoogleCodeExporter commented 9 years ago
It may be worth checking out this 
http://ria101.wordpress.com/2010/06/04/as3crypto-rsa-padding-function-
returned-null-bug-of-death-fix/

Original comment by thedwill...@gmail.com on 4 Jun 2010 at 4:28