dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]infinite while loop, i think in Convert.ToBase64String()


From: minddog
Subject: [DotGNU]infinite while loop, i think in Convert.ToBase64String()
Date: Tue, 31 Dec 2002 00:29:07 -0700
User-agent: KMail/1.4.3

Okay, was doin some base64 hackin and found this after adding --numBits and 
++numBits:



address@hidden:~/dotgnu/pnetlib$ ilrun ../homebrew-samples/a.out.exe 
Uncaught exception: System.IndexOutOfRangeException: An array index was out of 
range
        at System.Convert.ToBase64String(Byte[], Int32, Int32) in 
./System/Convert.cs:2633
        at Sample.Main()

to this:

   2626                                 while(size > 0)
   2627                                 {
   2628                                         bits = (bits << 8) + 
inArray[offset++];
   2629                                         numBits += 8;
   2630                                         --size;
   2631                                         while(numBits >= 6)
   2632                                         {
   2633                                              
builder.Append(base64[bits >> numBits]);
   2634                                                 bits &= ((1 << 
numBits) - 1);
   2635                                                 // infinite loop if no 
++numBits or --numBits
   2636                                         }
   2637                                 }


Can anyone determine whats up? 
-- 
--minddog( Adam Ballai )

"I try to take it one day at a time, but several of them attack me at once."
-mistyflip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]