[Mono-bugs] [Bug 75840][Nor] New - Convert.FromBase64String() results in extraneous 0 suffices

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 18 02:58:47 EDT 2005


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 atsushi at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=75840

--- shadow/75840	2005-08-18 02:58:47.000000000 -0400
+++ shadow/75840.tmp.18613	2005-08-18 02:58:47.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 75840
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Convert.FromBase64String() results in extraneous 0 suffices
+
+At r45784 we introduced unmanaged version of base64 decoder, but it does
+not handle "incomplete" block in base64 string. In such case, it returns
+padded zeros.
+
+Repro:
+
+using System;
+
+public class Test
+{
+        public static void Main ()
+        {
+                string base64 = "\n     fdy6S2NLpnT4fMdokUHSHsmpcvo=    ";
+                Console.WriteLine (base64);
+                foreach (byte b in Convert.FromBase64String (base64))
+                        Console.Write ("{0:X02} ", b);
+                Console.WriteLine ();
+        }
+}
+
+Expected results:
+7D DC BA 4B 63 4B A6 74 F8 7C C7 68 91 41 D2 1E C9 A9 72 FA
+
+Actual results:
+7D DC BA 4B 63 4B A6 74 F8 7C C7 68 91 41 D2 1E C9 A9 72 FA 00
+
+How often does this happen? 
+- consistently.
+
+Additional Information:
+This does not happen before r45783 i.e. unmanaged base64_to_byte_array
+(gunichar2 *start, gint ilength) in icall.c is the actual culprit.
+
+This breaks xmldsig standalone tests (r45783 works fine for them).


More information about the mono-bugs mailing list