[Mono-bugs] [Bug 43643][Maj] New - calling base indexer causes segmentation fault due to endless recursion

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sun, 25 May 2003 18:40:54 -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 ryabchuk@yahoo.com.

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

--- shadow/43643	Sun May 25 18:40:54 2003
+++ shadow/43643.tmp.15597	Sun May 25 18:40:54 2003
@@ -0,0 +1,92 @@
+Bug#: 43643
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ryabchuk@yahoo.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: calling base indexer causes segmentation fault due to endless recursion
+
+Description of Problem:
+calling base indexer causes segmentation fault due to endless recursion
+
+Steps to reproduce the problem:
+1. 
+Compile the following code
+
+using System;
+using System.Collections;
+
+namespace ConsoleApplication1
+{
+	class MyArray : ArrayList
+	{
+		public override object this[int index]
+		{
+			get { return base[index]; }
+			set { base[index] = value;}
+		}
+	}
+	class Class1
+	{
+		[STAThread]
+		static void Main(string[] args)
+		{
+			MyArray arr = new MyArray ( );
+			arr.Add ( "String value" );
+			System.Console.WriteLine ( arr[0].ToString ( ) );
+		}
+	}
+}
+
+Actual Results:
+
+code produced by MCS
+
+// method line 2
+    .method public virtual  hidebysig  specialname 
+           instance default object get_Item(int32 index)  cil managed 
+    {
+	.param [1]
+        // Method begins at RVA 0x20f4
+	// Code size 8 (0x8)
+	.maxstack 8
+	IL_0000: ldarg.0 
+	IL_0001: ldarg.1 
+	IL_0002: callvirt instance object class
+[corlib]System.Collections.ArrayList::get_Item(int32)
+	IL_0007: ret 
+    } // end of method MyArray::instance default object get_Item(int32 index) 
+
+Expected Results:
+
+code produced by CSC:
+
+method public hidebysig specialname virtual 
+        instance object  get_Item(int32 index) cil managed
+{
+  // Code size       12 (0xc)
+  .maxstack  3
+  .locals init (object V_0)
+  IL_0000:  ldarg.0
+  IL_0001:  ldarg.1
+  IL_0002:  call       instance object  
+[mscorlib]System.Collections.ArrayList::get_Item(int32)
+  IL_0007:  stloc.0
+  IL_0008:  br.s       IL_000a
+  IL_000a:  ldloc.0
+  IL_000b:  ret
+} // end of method MyArray::get_Item
+
+
+How often does this happen? 
+always