Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling with Delphi 10.2 Tokyo generate integer overflow #10

Open
sysbndt opened this issue Aug 28, 2017 · 2 comments
Open

Compiling with Delphi 10.2 Tokyo generate integer overflow #10

sysbndt opened this issue Aug 28, 2017 · 2 comments

Comments

@sysbndt
Copy link

sysbndt commented Aug 28, 2017

Using Delphi 10.2 Version 25.0.27659.1188
Using provided demo, compiling with debug configuration, changing compiler options to enable overflow checking and range checking, an EintOverflow is produced in TDebugInfoSMap.ProcessMap on the line:
Result^.SegStartAddress := Pointer((PSegment^.SegStartAddress - LModuleImageBase) + Module.ModuleHandle);
Actually SegStartAddress is 0 and both LModuleImageBase and ModuleHandle have same value ($400000).

@MahdiSafsafi
Copy link
Owner

MahdiSafsafi commented Aug 28, 2017

Hello,

Actually SegStartAddress is 0 and both LModuleImageBase and ModuleHandle have same value ($400000).

This is not always the case. Delphi debuginfo offsets are relative to the imagebase. However it's not always guaranteed that Windows loader will load the module at the specified address. So it's important to keep using the previous formula.

@sysbndt
Copy link
Author

sysbndt commented Aug 29, 2017

Nevertheless having an exception generated is not good at all. It means something is wrong with data types used. You should at least typecast to avoid the exception if you think the result is correct when overflow exception is turned on (Which is recommended for debugging purpose).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants