[Mono-bugs] [Bug 52928][Nor] New - FromBase64 throws wrong exception on invalid input
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jan 2004 04:59:32 -0500 (EST)
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 dave-mono@earth.li.
http://bugzilla.ximian.com/show_bug.cgi?id=52928
--- shadow/52928 2004-01-16 04:59:32.000000000 -0500
+++ shadow/52928.tmp.8182 2004-01-16 04:59:32.000000000 -0500
@@ -0,0 +1,69 @@
+Bug#: 52928
+Product: Mono/Class Libraries
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dave-mono@earth.li
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: FromBase64 throws wrong exception on invalid input
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1.
+using System;
+class t1
+{
+ static void Main(string [] args )
+ {
+ string brokenB64 = "AB~£";
+ Convert.FromBase64String(brokenB64);
+ }
+}
+
+2. Compile
+3. Run
+
+Actual Results:
+
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
+range
+in [0x0006b] (at
+/home/sheldon/hacking/mono/raw_cvs/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs:164)
+System.Security.Cryptography.FromBase64Transform:DoTransform
+(byte[],int,int,byte[],int)
+in [0x00078] (at
+/home/sheldon/hacking/mono/raw_cvs/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs:273)
+System.Security.Cryptography.FromBase64Transform:TransformFinalBlock
+(byte[],int,int)
+in [0x0005a] (at
+/home/sheldon/hacking/mono/raw_cvs/mcs/class/corlib/System/Convert.cs:107)
+System.Convert:FromBase64CharArray (char[],int,int)
+in [0x00018] (at
+/home/sheldon/hacking/mono/raw_cvs/mcs/class/corlib/System/Convert.cs:117)
+System.Convert:FromBase64String (string)
+in <0x00013> .t1:Main (string[])
+
+
+Expected Results:
+
+Unhandled Exception: System.FormatException
+
+Additional Information:
+
+The problem is with looking up the encoded data in the lookup tables. They
+seem to assume that they will only get valid data.
+
+I might look into creating a better Base64 handling class at the weekend.