Add support for large-address aware applications#21
Merged
Conversation
learn-more
reviewed
May 5, 2022
|
|
||
| // Without the double casting, the pointer is sign extended, not zero extended, | ||
| // which leads to invalid addresses with /LARGEADDRESSAWARE. | ||
| #define PTR_TO_DWORD64(p) ((DWORD64)(DWORD)(p)) |
There was a problem hiding this comment.
If this is ever called from x64 code, it will truncate the pointer
Contributor
Author
There was a problem hiding this comment.
Yes, wow64ext is an x32-only library, but PTR_TO_DWORD64 might be helpful in generic code outside of the library. I changed the macro, should be fine now, thanks.
rwfpl
approved these changes
Jun 19, 2022
|
PTR_TO_DWORD64 not applicable to hProcess |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Large-address aware applications linked with the
/LARGEADDRESSAWAREflag can have a user-mode address with its upper bit set. The current code sign-extends the pointer, e.g.87aaeb58toffffffff87aaeb58, leading to an invalid pointer and likely to a crash.I discovered this due to a bug report for Windhawk:
ramensoftware/windhawk#3
I came up with a small program which triggers the bug most of the time:
https://gist.github.com/m417z/7177d820252ab42f4d86c905589b6f05
Also, a similar notice regarding 32-bit to 64-bit pointer casting can be found here: