Bug 312972 (MONO49725) - Array of invalid size is created.
Summary: Array of invalid size is created.
Status: RESOLVED MOVED
Alias: MONO49725
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-16 10:26 UTC by Yury Malich
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:17:09 UTC


---- Reported by malich_y@mail.ru 2003-10-16 03:26:38 MST ----

Please fill in this template when reporting a bug, unless you know what you 
are doing.
Description of Problem:

Array of invalid size is created.

Steps to reproduce the problem:
1. 
using System;

namespace monobag
{
	
	class App
	{
		static uint ArraySize=1000000;
		[STAThread]
		static void Main(string[] args)
		{
			uint len=(ArraySize / 100)*8+100;
			//UInt32[] array=new UInt32[(uint)Math.Floor(Math.Sqrt(len))
+100];	
			UInt32[] array=new UInt32[((uint)Math.Floor(Math.Sqrt(len)) )
+100];	// the statement results in creating an array of invalid size
			Console.WriteLine("array.Len:"+array.Length.ToString()); // pri
			uint len2=(uint)Math.Floor(Math.Sqrt(len))+100;
			UInt32[] array2=new UInt32[len2];	
			Console.WriteLine("array2.Len:"+array2.Length.ToString());
		}
	}
}

2. mono-0.28-win32-1.exe

 

Actual Results:
Command line1: 
mono.exe monobag.exe
Output: 
array.Len:19311148
array2.Len:383

Command line2: 
mono.exe --optimize=all monobag.exe
Output: 
array.Len:100
array2.Len:383


Expected Results:
Under MS .Net Framework Output: 
array.Len:383
array2.Len:383
//UInt32[] array=new UInt32[((uint)Math.Floor(Math.Sqrt(len)) )+100];
	// the statement results in creating an array of 383 elements!


How often does this happen? 
Always

Additional Information:
mono-0.28-win32-1.exe under Win2k + SP4



---- Additional Comments From vargaz@freemail.hu 2003-10-16 16:48:42 MST ----

This is the same as 30073 which is already fixed in CVS.

*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO30073 ***


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Win2k + SP4</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"