Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I Fixed ---- Arithmetic operation resulted in an overflow. (ReClass.NET) #264

Open
@chrisjd20

Description

I got this error on 64bit compiled version against a 64 bit process I was memory searching (had to change it to a long):

===================================
Arithmetic operation resulted in an overflow. (ReClass.NET)
------------------------------
For help, click: https://github.com/ReClassNET/ReClass.NET/issues
------------------------------
Program Location:
 at ReClassNET.MemoryScanner.Scanner.ConsolidateSections(IList`1 sections) in C:\Users\chris\Downloads\ReClass.NET-master\ReClass.NET\MemoryScanner\Scanner.cs:line 344
 at ReClassNET.MemoryScanner.Scanner.FirstScan(IScanComparer comparer, IProgress`1 progress, CancellationToken ct) in C:\Users\chris\Downloads\ReClass.NET-master\ReClass.NET\MemoryScanner\Scanner.cs:line 201
 at ReClassNET.Forms.ScannerForm.<StartFirstScanEx>d__43.MoveNext() in C:\Users\chris\Downloads\ReClass.NET-master\ReClass.NET\Forms\ScannerForm.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at ReClassNET.Forms.ScannerForm.<firstScanButton_Click>d__17.MoveNext() in C:\Users\chris\Downloads\ReClass.NET-master\ReClass.NET\Forms\ScannerForm.cs:line 142

I fixed it by changing Scanner.cs

		class ConsolidatedMemoryRegion
		{
			public IntPtr Address { get; set; }
			public int Size { get; set; } // Keep as int
		}

Also in that same file:

		private static List<ConsolidatedMemoryRegion> ConsolidateSections(IList<Section> sections)
		{
			var regions = new List<ConsolidatedMemoryRegion>();
			if (sections.Count > 0)
			{
				var address = sections[0].Start;
				long size = sections[0].Size.ToInt64(); // Updated to long
				for (var i = 1; i < sections.Count; ++i)
				{
					var section = sections[i];
					if (address + (int)size != section.Start) // Updated to cast to int
					{
						regions.Add(new ConsolidatedMemoryRegion { Address = address, Size = (int)size }); // Updated to cast to int
						address = section.Start;
						size = section.Size.ToInt64(); // Updated to long
					}
					else
					{
						size += section.Size.ToInt64(); // Updated to long
					}
				}
				regions.Add(new ConsolidatedMemoryRegion { Address = address, Size = (int)size }); // Updated to cast to int
			}
			return regions;
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /