News for hackers. Stuff that matters.
Re:Why is my x64 process getting heap address above 4GB on W... by xg15 on Sunday July 12, 2015 @12:33PM (#9873958)
> For a short-term fix, for example, I can very well imagine to prefer this "trick" forcing sub-4G allocations ...

But that's not what this is doing - it's taking an address allocated at an arbitrary place and then pretends that it was allocated sub-4G, whether or not it actually was. If it happens that it wasn't, this will likely cause memory corruption or an access violation.

Even if your product is nearing end-of-life, I'd still consider such a move a big "f* you" to your customers as you'd basically be tolerating that your product may crash without warning at any time.

From what I understood, what makes this idea so bad isn't truncating to 32bit - it's truncating to 32 bit while setting the LARGEADDRESSAWARE build flag - which basically tells the OS "I'm fine with all kinds of 64bit addresses, bring them on!"

The correct fix is outlined at the end of the article - and it does not involve combing through undocumented legacy code:

> If there is some fundamental reason that they have to truncate pointers to 32-bit values, then they should build without /LARGEADDRESSAWARE so that the process will be given an address space of only 2GB, and then they can truncate their pointers all they want.

There are no comments on this comment yet.