Browse Source

Patch from Vincent Snijders, sent to fpc-devel
add the same sanity check for the frame pointer
in TraceReAllocMem as already is in TraceGetMem.

git-svn-id: trunk@7086 -

pierre 18 years ago
parent
commit
9137533864
1 changed files with 4 additions and 0 deletions
  1. 4 0
      rtl/inc/heaptrc.pp

+ 4 - 0
rtl/inc/heaptrc.pp

@@ -628,6 +628,7 @@ var
   allocsize,
   allocsize,
   movesize,
   movesize,
   i  : ptrint;
   i  : ptrint;
+  oldbp,
   bp : pointer;
   bp : pointer;
   pl : pdword;
   pl : pdword;
   pp : pheap_mem_info;
   pp : pheap_mem_info;
@@ -745,7 +746,10 @@ begin
   for i:=1 to tracesize do
   for i:=1 to tracesize do
    begin
    begin
      pp^.calls[i]:=get_caller_addr(bp);
      pp^.calls[i]:=get_caller_addr(bp);
+     oldbp:=bp;
      bp:=get_caller_frame(bp);
      bp:=get_caller_frame(bp);
+     if (bp<oldbp) or (bp>(StackBottom + StackLength)) then
+       bp:=nil;
    end;
    end;
   { regenerate signature }
   { regenerate signature }
   if usecrc then
   if usecrc then