- Notifications
You must be signed in to change notification settings - Fork12
Fix uncaught exception when trying to retrieve negative addresses#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
KN4CK3R commentedDec 7, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
TETYYS commentedDec 7, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
TETYYS commentedDec 7, 2018
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 |
TETYYS commentedDec 7, 2018
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
| returntrue; | ||
| } | ||
| using(varstream=info.File.CreateViewStream(address.ToInt64(),size)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Now you are missing the addressInt64 here.
TETYYS commentedDec 7, 2018
There are some places in C# library methods I really wish that would just accept or provide |
KN4CK3R commentedDec 7, 2018
I will add a new extension method for IntPtr in the ReClass.NET project to make the logic reusable. |
No description provided.