[Mono-patches] r102358 - trunk/mono/mono/metadata

Atsushi Enomoto (atsushi@ximian.com) mono-patches-list at lists.ximian.com
Fri May 2 13:58:42 EDT 2008


Author: atsushi
Date: 2008-05-02 13:58:42 -0400 (Fri, 02 May 2008)
New Revision: 102358

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/icall.c
Log:
2008-05-02  Atsushi Enomoto  <atsushi at ximian.com>

        * icall.c : base64_to_byte_array() needs some more strict
          check for sequence of '=' characters. Patch by Santa
          Marta (http://deee.g.hatena.ne.jp/santamarta).

          Contributed under MIT/X11 license.
          (see http://www.lingr.com/room/mono-jp/archives/2008/04/20)



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog	2008-05-02 17:55:41 UTC (rev 102357)
+++ trunk/mono/mono/metadata/ChangeLog	2008-05-02 17:58:42 UTC (rev 102358)
@@ -1,3 +1,12 @@
+2008-05-02  Atsushi Enomoto  <atsushi at ximian.com>
+
+	* icall.c : base64_to_byte_array() needs some more strict
+	  check for sequence of '=' characters. Patch by Santa
+	  Marta (http://deee.g.hatena.ne.jp/santamarta).
+
+	  Contributed under MIT/X11 license.
+	  (see http://www.lingr.com/room/mono-jp/archives/2008/04/20)
+
 2008-05-02  Jonathan Chambers  <joncham at gmail.com>
 
 	* domain.c: Disable LoadLibrary support to fix Win32 build.

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c	2008-05-02 17:55:41 UTC (rev 102357)
+++ trunk/mono/mono/metadata/icall.c	2008-05-02 17:58:42 UTC (rev 102358)
@@ -6970,7 +6970,7 @@
 	gint ignored;
 	gint i;
 	gunichar2 c;
-	gunichar2 last, prev_last;
+	gunichar2 last, prev_last, prev2_last;
 	gint olength;
 	MonoArray *result;
 	guchar *res_ptr;
@@ -6978,7 +6978,7 @@
 	MonoException *exc;
 
 	ignored = 0;
-	last = prev_last = 0;
+	last = prev_last = 0, prev2_last = 0;
 	for (i = 0; i < ilength; i++) {
 		c = start [i];
 		if (c >= sizeof (dbase64)) {
@@ -6989,6 +6989,7 @@
 		} else if (isspace (c)) {
 			ignored++;
 		} else {
+			prev2_last = prev_last;
 			prev_last = last;
 			last = c;
 		}
@@ -7006,6 +7007,11 @@
 		mono_raise_exception (exc);
 	}
 
+	if (prev2_last == '=') {
+		exc = mono_exception_from_name_msg (mono_get_corlib (), "System", "FormatException", "Invalid format.");
+		mono_raise_exception (exc);
+	}
+
 	olength = (olength * 3) / 4;
 	if (last == '=')
 		olength--;



More information about the Mono-patches mailing list