mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
nodes/patterns: Fixed crashes when recursion occurred
This commit is contained in:
@@ -33,6 +33,16 @@ namespace hex::lang {
|
||||
} else
|
||||
return false;
|
||||
});
|
||||
|
||||
this->m_preprocessor->addPragmaHandler("eval_depth", [this](std::string value) {
|
||||
auto limit = strtol(value.c_str(), nullptr, 0);
|
||||
|
||||
if (limit <= 0)
|
||||
return false;
|
||||
|
||||
this->m_recursionLimit = limit;
|
||||
return true;
|
||||
});
|
||||
this->m_preprocessor->addDefaultPragmaHandlers();
|
||||
}
|
||||
|
||||
@@ -56,6 +66,9 @@ namespace hex::lang {
|
||||
return { };
|
||||
}
|
||||
|
||||
this->m_evaluator->setDefaultEndian(this->m_defaultEndian);
|
||||
this->m_evaluator->setRecursionLimit(this->m_recursionLimit);
|
||||
|
||||
auto tokens = this->m_lexer->lex(preprocessedCode.value());
|
||||
if (!tokens.has_value()) {
|
||||
this->m_currError = this->m_lexer->getError();
|
||||
|
||||
Reference in New Issue
Block a user