mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 16:41:07 +00:00
Fixed potential crash in ACS engine
Unknown p-code in compiled script may lead to a crash if the current module was changed during script execution, e.g. by function call See http://forum.zdoom.org/viewtopic.php?f=2&t=48524
This commit is contained in:
parent
211f12286a
commit
b2fa4970fd
1 changed files with 2 additions and 0 deletions
|
@ -6032,6 +6032,7 @@ int DLevelScript::RunScript ()
|
||||||
int sp = 0;
|
int sp = 0;
|
||||||
int *pc = this->pc;
|
int *pc = this->pc;
|
||||||
ACSFormat fmt = activeBehavior->GetFormat();
|
ACSFormat fmt = activeBehavior->GetFormat();
|
||||||
|
FBehavior* const savedActiveBehavior = activeBehavior;
|
||||||
unsigned int runaway = 0; // used to prevent infinite loops
|
unsigned int runaway = 0; // used to prevent infinite loops
|
||||||
int pcd;
|
int pcd;
|
||||||
FString work;
|
FString work;
|
||||||
|
@ -6065,6 +6066,7 @@ int DLevelScript::RunScript ()
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
Printf ("Unknown P-Code %d in %s\n", pcd, ScriptPresentation(script).GetChars());
|
Printf ("Unknown P-Code %d in %s\n", pcd, ScriptPresentation(script).GetChars());
|
||||||
|
activeBehavior = savedActiveBehavior;
|
||||||
// fall through
|
// fall through
|
||||||
case PCD_TERMINATE:
|
case PCD_TERMINATE:
|
||||||
DPrintf ("%s finished\n", ScriptPresentation(script).GetChars());
|
DPrintf ("%s finished\n", ScriptPresentation(script).GetChars());
|
||||||
|
|
Loading…
Reference in a new issue