FastMM_LogStackTrace has a pointer truncation bug in x64

delphi package - automated exception handling
Post Reply
davidheffernan
Posts: 89
Joined: Thu Feb 23, 2012 12:22 pm

FastMM_LogStackTrace has a pointer truncation bug in x64

Post by davidheffernan »

In FastMM_LogStackTrace, this line:

Code: Select all

if TPAInteger(preparedStack)[i1] = 0 then begin
should be

Code: Select all

if TPAPointer(preparedStack)[i1] = nil then begin
The error is, of course, benign in x86, but means that stack traces are typically truncated to a single return value under x64.

I also discovered that FastMM_LogStackTrace is not compatible with the delayStackWalk64 conditional, again for pretty obvious reasons. I can fix that easily enough when I build the FastMM_FullDebugMode DLL but you may wish to consider making madExcept handle that situation more elegantly.
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Re: FastMM_LogStackTrace has a pointer truncation bug in x64

Post by madshi »

You're right, I'll need to look into this.
Post Reply