[Mono-bugs] [Bug 38812][Min] New - Array.Copy doesn't check member types.
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Thu, 27 Feb 2003 08:57:31 -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 martin@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=38812
--- shadow/38812 Thu Feb 27 08:57:31 2003
+++ shadow/38812.tmp.19026 Thu Feb 27 08:57:31 2003
@@ -0,0 +1,51 @@
+Bug#: 38812
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: martin@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Array.Copy doesn't check member types.
+
+The following must throw an InvalidCastException at runtime, but it does not:
+
+====
+using System;
+
+class A
+{
+}
+
+class B : A
+{
+}
+
+class C : A
+{
+}
+
+class X
+{
+ static void Test (A[] a)
+ {
+ B[] b = new B [a.Length];
+ a.CopyTo (a, 0);
+ }
+
+ static void Main ()
+ {
+ C[] c = new C [] { new C () };
+
+ Test (c);
+ }
+}
+====