Fix uncaught exception when trying to retrieve negative addresses#3
Fix uncaught exception when trying to retrieve negative addresses#3KN4CK3R merged 4 commits intoReClassNET:masterfrom
Conversation
|
Did you test a negative address intentional or how did you get this exception? Your patch doesn't fix the problem. Now you can't access offsets greater than int.MaxValue (2GB). I'm a little bit shocked that y and z are both negative... I expected z to show a large number instead of -1. |
|
I think I got the exception when the program tried to construct a BaseHexCommentNode, presumably dereferencing an address, my file is exactly 2,147,516,415 bytes in size. |
|
I think the problem with this is that when pointer in IntPtr is 0x8000_0000, the ToInt64() operation does not cast bit-wise, resulting in same negative value |
|
I think this should work. The plugin fails to read valid bytes if you try to read after the file, but that's a different issue, I think I saw 64 byte blocks hardcoded somewhere, this might be related to that. |
LoadBinaryPluginExt.cs
Outdated
|
|
||
| return true; | ||
| } | ||
| using (var stream = info.File.CreateViewStream(address.ToInt64(), size)) |
There was a problem hiding this comment.
Now you are missing the addressInt64 here.
|
There are some places in C# library methods I really wish that would just accept or provide |
|
I will add a new extension method for IntPtr in the ReClass.NET project to make the logic reusable. |
No description provided.