Attached patch add the same sanity check for the frame pointer in TraceReAllocMem as already is in TraceGetMem. It fixed crashes of Lazarus on win64 when compiled with heaptrc.

Tested with fpc 2.1.3. fpc 2.3.1 is currently broken on win64, see mail of 8 
April.

Vincent
Index: heaptrc.pp
===================================================================
--- heaptrc.pp	(revision 7084)
+++ heaptrc.pp	(working copy)
@@ -628,6 +628,7 @@
   allocsize,
   movesize,
   i  : ptrint;
+  oldbp,
   bp : pointer;
   pl : pdword;
   pp : pheap_mem_info;
@@ -745,7 +746,10 @@
   for i:=1 to tracesize do
    begin
      pp^.calls[i]:=get_caller_addr(bp);
+     oldbp:=bp;
      bp:=get_caller_frame(bp);
+     if (bp<oldbp) or (bp>(StackBottom + StackLength)) then
+       bp:=nil;
    end;
   { regenerate signature }
   if usecrc then
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to