[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.


--- 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   
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dave-mono@earth.li               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+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:
+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
+in [0x0006b] (at
+in [0x00078] (at
+in [0x0005a] (at
+System.Convert:FromBase64CharArray (char[],int,int)
+in [0x00018] (at
+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.