mirror of https://github.com/OpenTTD/OpenTTD
Fix #8851: don't allow infinite "exec" depth in script, but limit to 10 deep
This means if you execute a script from a script from a script, .. for more than 10 times, it bails out now. This should be sufficient for even the most complex scripts.pull/8858/head
parent
8230cd009d
commit
5056e963ba
|
@ -960,6 +960,11 @@ DEF_CONSOLE_CMD(ConExec)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (_script_current_depth == 11) {
|
||||
IConsoleError("Maximum 'exec' depth reached; script A is calling script B is calling script C ... more than 10 times.");
|
||||
return true;
|
||||
}
|
||||
|
||||
_script_current_depth++;
|
||||
uint script_depth = _script_current_depth;
|
||||
|
||||
|
|
Loading…
Reference in New Issue