[Mono-bugs] [Bug 52093][Nor] New - vectors need to be different types from arrays with rank == 1
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jan 2004 11:15:35 -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 vargaz@freemail.hu.
http://bugzilla.ximian.com/show_bug.cgi?id=52093
--- shadow/52093 2004-01-16 11:15:35.000000000 -0500
+++ shadow/52093.tmp.10397 2004-01-16 11:15:35.000000000 -0500
@@ -0,0 +1,52 @@
+Bug#: 52093
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details:
+Status: RESOLVED
+Resolution: FIXED
+Severity: Unknown
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: lupus@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: vectors need to be different types from arrays with rank == 1
+
+This test case fails in mono.
+
+using System;
+
+class T {
+
+ static int Main () {
+ int[] a = new int [1];
+ int[] b;
+ Array arr = null;
+ bool cast_failed = false;
+ try {
+ arr = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
+ b = (int[])arr;
+ } catch {
+ cast_failed = true;
+ }
+ Console.WriteLine (a.GetType().ToString ());
+ Console.WriteLine (arr.GetType().ToString ());
+ return cast_failed? 0: 1;
+ }
+}
+
+------- Additional Comments From vargaz@freemail.hu 2003-12-13 12:09 -------
+Is this behavior mandated by the spec ? Also, is allowing this
+conversion unsafe, i.e. can it be used to break the type system etc ?
+
+------- Additional Comments From lupus@ximian.com 2003-12-13 13:32 -------
+Yes, it's in the spec somewhere.
+And yes, it can probably be used to access random memory
+by playing with the bounds.
+
+------- Additional Comments From vargaz@freemail.hu 2004-01-16 11:15 -------
+Fixed in CVS.