mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 08:28:09 +02:00
* instead of registering all and then deleting non-propgetter/setter procdefs in
pdecvar.read_property_dec, don't register them by default, and then only register them, if they are propgetter/setter. This prevents dangling pointers in current_module.deflist and potential use-after-free bugs. git-svn-id: trunk@48998 -
This commit is contained in:
parent
9e9859f145
commit
d608b4b689
@ -360,8 +360,8 @@ implementation
|
||||
{ Generate temp procdefs to search for matching read/write
|
||||
procedures. the readprocdef will store all definitions }
|
||||
paranr:=0;
|
||||
readprocdef:=cprocdef.create(normal_function_level,true);
|
||||
writeprocdef:=cprocdef.create(normal_function_level,true);
|
||||
readprocdef:=cprocdef.create(normal_function_level,false);
|
||||
writeprocdef:=cprocdef.create(normal_function_level,false);
|
||||
|
||||
readprocdef.struct:=astruct;
|
||||
writeprocdef.struct:=astruct;
|
||||
@ -857,11 +857,14 @@ implementation
|
||||
message1(parser_e_implements_uses_non_implemented_interface,def.typename);
|
||||
until not try_to_consume(_COMMA);
|
||||
|
||||
{ remove unneeded procdefs }
|
||||
if readprocdef.proctypeoption<>potype_propgetter then
|
||||
readprocdef.owner.deletedef(readprocdef);
|
||||
if writeprocdef.proctypeoption<>potype_propsetter then
|
||||
writeprocdef.owner.deletedef(writeprocdef);
|
||||
{ register propgetter and propsetter procdefs }
|
||||
if assigned(current_module) and current_module.in_interface then
|
||||
begin
|
||||
if readprocdef.proctypeoption=potype_propgetter then
|
||||
readprocdef.register_def;
|
||||
if writeprocdef.proctypeoption=potype_propsetter then
|
||||
writeprocdef.register_def;
|
||||
end;
|
||||
|
||||
result:=p;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user