Bug 324523 (MONO81848) - checked fails to detect integer overflow
Summary: checked fails to detect integer overflow
Status: RESOLVED INVALID
Alias: MONO81848
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Raja R Harinath
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: security
Depends on:
Blocks:
 
Reported: 2007-06-10 18:07 UTC by Dominic
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 20:41:19 UTC


---- Reported by zerberous@googlemail.com 2007-06-10 11:07:33 MST ----

Description of Problem:

checked fails with integer overflow.


Steps to reproduce the problem:

Create project gtk, in mono-develop,
enter following app:

---------------------------------
// project created on 6/9/2007 at 10:51 PM
using System;
using Gtk;

namespace test2
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			checked { 
				int i=int.MaxValue;
				i=+10000; 
				Console.Write("not catched : " + i + "\n");
			}
			
			checked { 
				int i=int.MaxValue;
				i=i+10000; 
				Console.Write("catched : " + i + "\n");
			}
			
			Application.Init ();
			MainWindow win = new MainWindow ();
			win.Show ();
			Application.Run ();
			
		}
	}
}
---------------------------------




Actual Results:

not catched : 10000
catched : -2147473649


Expected Results:

an overflow exception


How often does this happen? 

always

Additional Information:

debug target in mono-develop selected



---- Additional Comments From zerberous@googlemail.com 2007-06-10 13:56:07 MST ----


misinterpreted

i=+10000; 

for

i+=10000;

mono is just fine.



Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>2.6.20-16-generic #2 SMP - ubuntu feisty</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".