Skip to content

Commit

Permalink
fix infinite loop when a process closes and $ symbols are used
Browse files Browse the repository at this point in the history
  • Loading branch information
cheat-engine committed Nov 15, 2022
1 parent e308f4a commit 8dd87bd
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Cheat Engine/symbolhandler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4923,6 +4923,7 @@ function TSymhandler.getAddressFromName(name: string; waitforsymbols: boolean; o
mr: TMemoryrecord;
contexthandler: TContextInfo;
reg: PContextElement_register;
e: boolean;

function ApplyTokenType(value: qword): qword;
begin
Expand Down Expand Up @@ -5390,16 +5391,23 @@ function TSymhandler.getAddressFromName(name: string; waitforsymbols: boolean; o
if lua_isstring(LuaVM, j+1) then
begin
s:=lua_tostring(LuaVM, j+1);

if pos('$',s)=0 then //prevent inf lua loops
begin
try
tokens[i]:=inttohex(ApplyTokenType(getAddressFromName(s)),8);
except
//fail, try one more time with quotes
tokens[i]:=inttohex(ApplyTokenType(getAddressFromName('"'+s+'"')),8);
e:=false;
tokens[i]:=inttohex(ApplyTokenType(getAddressFromName(s,true,e)),8);
if e then //fail, try one more time with quotes
tokens[i]:=inttohex(ApplyTokenType(getAddressFromName('"'+s+'"',true,e)),8);

if e then
begin
haserror:=true;
exit;
end;

continue;
end;

end;
finally
lua_settop(luavm,j);
Expand Down

0 comments on commit 8dd87bd

Please sign in to comment.