[Mono-bugs] [Bug 44304][Cos] Changed - Assertion, not exception when array with rank > 255 is created

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sun, 8 Jun 2003 15:14:15 -0400 (EDT)


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 duncan@ximian.com.

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

--- shadow/44304	Sun Jun  8 13:41:35 2003
+++ shadow/44304.tmp.7216	Sun Jun  8 15:14:15 2003
@@ -1,12 +1,12 @@
 Bug#: 44304
 Product: Mono/Runtime
 Version: unspecified
 OS: other
 OS Details: 
-Status: NEW   
+Status: RESOLVED   
 Resolution: 
 Severity: Unknown
 Priority: Cosmetic
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: bmaurer@users.sf.net               
@@ -57,6 +57,40 @@
 How often does this happen? 
 Always.
 
 
 Additional Information:
 This is from the Rotor test suite. File: co3745createinstance_type_iarr.cs
+
+------- Additional Comments From duncan@ximian.com  2003-06-08 15:14 -------
+I first tried to fix the bug in mono_array_class_get, which is in
+class.c. It seemed simple enough, but I couldn't get it to link properly.
+
+Then Paolo told me to do it in C# instead, aha!
+
+This patch makes the assertion thing go away, and throws a
+TypeLoadException instead:
+
+diff -u -p -r1.49 Array.cs
+--- Array.cs	29 May 2003 02:32:38 -0000	1.49
++++ Array.cs	8 Jun 2003 19:22:35 -0000
+@@ -301,6 +301,9 @@ namespace System
+ 
+ 	public static Array CreateInstance(Type elementType, int[] lengths)
+ 	{
++               if (lengths.Length > 255)
++                       throw new TypeLoadException ();
++
+ 		int[] bounds = null;
+ 			
+ 		return CreateInstanceImpl (elementType, lengths, bounds);
+@@ -310,6 +313,9 @@ namespace System
+ 	{
+ 		if (bounds == null)
+ 			throw new ArgumentNullException("bounds");
++
++               if (lengths.Length > 255)
++                       throw new TypeLoadException ();
+
+Fixed in CVS.
+
+(ps. Sigh, frigging bugzilla lost my last entry)