mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 11:08:02 +02:00
* avoid leaving a dangling pointer in pparautl.proc_add_definition to prevent
use after free in different parts of the compiler git-svn-id: trunk@49222 -
This commit is contained in:
parent
711efc3e3a
commit
d8f02107a1
@ -780,6 +780,7 @@ implementation
|
||||
forwardfound : boolean;
|
||||
symentry: TSymEntry;
|
||||
item : tlinkedlistitem;
|
||||
tmpidx: Integer;
|
||||
begin
|
||||
forwardfound:=false;
|
||||
|
||||
@ -1092,6 +1093,10 @@ implementation
|
||||
|
||||
{ Release current procdef }
|
||||
currpd.owner.deletedef(currpd);
|
||||
{ this prevents a dangling pointer and use after free }
|
||||
tmpidx:=current_module.deflist.IndexOfItem(currpd,FromEnd);
|
||||
if tmpidx<>-1 then
|
||||
current_module.deflist[tmpidx]:=nil;
|
||||
currpd:=fwpd;
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user