[Mono-bugs] [Bug 26821][Wis] New - Off by one error in mono/mono/metadata/icall.c, ves_icall_System_Reflection_Assembly_GetTypes

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
21 Jun 2002 23:17:35 -0000


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 bob@karr.ath.cx.

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

--- shadow/26821	Fri Jun 21 19:17:35 2002
+++ shadow/26821.tmp.28403	Fri Jun 21 19:17:35 2002
@@ -0,0 +1,46 @@
+Bug#: 26821
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bob@karr.ath.cx               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Off by one error in mono/mono/metadata/icall.c, ves_icall_System_Reflection_Assembly_GetTypes
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The code for System.Reflection.Assembly::GetTypes contains an off by one
+error that causes the array returned to contain an extra null element.
+
+Steps to reproduce the problem:
+1. Call Assembly::GetTypes on an assembly object
+2. Try to access last element
+3. 
+
+Actual Results:
+The last elements is null
+
+Expected Results:
+Last element should be a reference to a type
+
+How often does this happen? 
+Always
+
+Additional Information:
+Fix is to replace, in ves_icall_System_Reflection_Assembly_GetTypes, the line:
+
+res = mono_array_new (domain, mono_defaults.monotype_class, count);
+
+with:
+
+res = mono_array_new (domain, mono_defaults.monotype_class, count-1);