mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 10:49:27 +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;
|
forwardfound : boolean;
|
||||||
symentry: TSymEntry;
|
symentry: TSymEntry;
|
||||||
item : tlinkedlistitem;
|
item : tlinkedlistitem;
|
||||||
|
tmpidx: Integer;
|
||||||
begin
|
begin
|
||||||
forwardfound:=false;
|
forwardfound:=false;
|
||||||
|
|
||||||
@ -1092,6 +1093,10 @@ implementation
|
|||||||
|
|
||||||
{ Release current procdef }
|
{ Release current procdef }
|
||||||
currpd.owner.deletedef(currpd);
|
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;
|
currpd:=fwpd;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user