2005-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 18 Aug 2005 14:25:03 +0000 (14:25 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 18 Aug 2005 14:25:03 +0000 (14:25 -0000)
* icall.c: there might be ignored whitespace after the last '='. This
fixes length computation and bug #75840.

svn path=/trunk/mono/; revision=48500

mono/metadata/ChangeLog
mono/metadata/icall.c

index 998f01be15e206875c38ab164b3eaf7a89e0f186..9b8aaa8206782fef26232341a1b24aaad4482caa 100644 (file)
@@ -1,9 +1,15 @@
+2005-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * icall.c: there might be ignored whitespace after the last '='. This
+       fixes length computation and bug #75840.
+
 2005-08-18  Zoltan Varga  <vargaz@freemail.hu>
 
        * assembly.c (mono_assembly_load_full): Consider .exe extension as
        well. Fixes #75809.
 
-       * reflection.c (create_custom_attr): Fix unmanaged memory leak. Fixes #75784.
+       * reflection.c (create_custom_attr): Fix unmanaged memory leak. Fixes
+       #75784.
        
        * reflection.c (create_custom_attr_data): Ditto.
 
@@ -16100,3 +16106,4 @@ Tue Jul  3 18:33:32 CEST 2001 Paolo Molaro <lupus@ximian.com>
 
        * mono/metadata/assembly.c (load_metadata_ptrs): Fix for Beta2
 
+
index 1a22c58e977aaaf9e84a2ed15e73ac05baabbe72..cc6b17f5b51d8e80183772c4c93d24c42a76740e 100644 (file)
@@ -6057,6 +6057,7 @@ base64_to_byte_array (gunichar2 *start, gint ilength)
        gint ignored;
        gint i;
        gunichar2 c;
+       gunichar2 last, prev_last;
        gint olength;
        MonoArray *result;
        guchar *res_ptr;
@@ -6064,6 +6065,7 @@ base64_to_byte_array (gunichar2 *start, gint ilength)
        MonoException *exc;
 
        ignored = 0;
+       last = prev_last = 0;
        for (i = 0; i < ilength; i++) {
                c = start [i];
                if (isspace (c)) {
@@ -6073,6 +6075,9 @@ base64_to_byte_array (gunichar2 *start, gint ilength)
                                "System", "FormatException",
                                "Invalid character found.");
                        mono_raise_exception (exc);
+               } else {
+                       prev_last = last;
+                       last = c;
                }
        }
 
@@ -6084,10 +6089,10 @@ base64_to_byte_array (gunichar2 *start, gint ilength)
        }
 
        olength = (olength * 3) / 4;
-       if (start [ilength - 1] == '=')
+       if (last == '=')
                olength--;
 
-       if (start [ilength - 2] == '=')
+       if (prev_last == '=')
                olength--;
 
        result = mono_array_new (mono_domain_get (), mono_defaults.byte_class, olength);