mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-08 23:10:36 +00:00
context safties
and from Marauder, hardened filename entry for con::evaluate/compileexec. if the string forwarded along is not a real filename, consider it an eval block
This commit is contained in:
parent
19d8a5525d
commit
80f62573fe
8 changed files with 21 additions and 18 deletions
|
|
@ -611,7 +611,7 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
|||
Script::gStatementList = NULL;
|
||||
|
||||
// we are an eval compile if we don't have a file name associated (no exec)
|
||||
gIsEvalCompile = fileName == NULL;
|
||||
gIsEvalCompile = fileName == NULL || setFrame == 0;
|
||||
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : &gGlobalScopeFuncVars;
|
||||
|
||||
// Set up the parser.
|
||||
|
|
|
|||
|
|
@ -38,8 +38,10 @@ namespace TorqueScript
|
|||
if (fileName)
|
||||
fileName = StringTable->insert(fileName);
|
||||
|
||||
bool fileExec = Torque::FS::IsFile(fileName);
|
||||
|
||||
CodeBlock* newCodeBlock = new CodeBlock();
|
||||
return (newCodeBlock->compileExec(fileName, string, false, fileName ? -1 : 0));
|
||||
return (newCodeBlock->compileExec(fileName, string, false, fileExec ? -1 : 0));
|
||||
}
|
||||
|
||||
Con::EvalResult TorqueScriptRuntime::evaluate(const char* script, S32 frame, bool echo, const char* fileName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue