patterns: Disallow calling of dangerous functions by default

Closes #330
This commit is contained in:
WerWolv
2021-12-19 12:32:15 +01:00
parent 0efb226c2f
commit 376cb01a16
13 changed files with 128 additions and 25 deletions

View File

@@ -127,6 +127,11 @@ namespace hex::pl {
this->m_scopes.clear();
this->m_aborted = false;
if (this->m_allowDangerousFunctions == DangerousFunctionPermission::Deny)
this->m_allowDangerousFunctions = DangerousFunctionPermission::Ask;
this->m_dangerousFunctionCalled = false;
ON_SCOPE_EXIT {
this->m_envVariables.clear();
};

View File

@@ -185,4 +185,13 @@ namespace hex::pl {
return this->m_evaluator->getPatternLimit();
}
void PatternLanguage::allowDangerousFunctions(bool allow) {
this->m_evaluator->allowDangerousFunctions(allow);
}
bool PatternLanguage::hasDangerousFunctionBeenCalled() const {
return this->m_evaluator->hasDangerousFunctionBeenCalled();
}
}