diff --git a/lib/libimhex/include/hex/pattern_language/ast_node.hpp b/lib/libimhex/include/hex/pattern_language/ast_node.hpp index f1b2bf384..797c2fbbc 100644 --- a/lib/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/lib/libimhex/include/hex/pattern_language/ast_node.hpp @@ -969,7 +969,7 @@ namespace hex::pl { evaluator->dataOffset() = startOffset; - u128 entryCount = 0; + i128 entryCount = 0; if (this->m_size != nullptr) { auto sizeNode = this->m_size->evaluate(evaluator); @@ -988,6 +988,9 @@ namespace hex::pl { evaluator->handleAbort(); } } + + if (entryCount < 0) + LogConsole::abortEvaluation("array cannot have a negative size", this); } else { std::vector buffer(templatePattern->getSize()); while (true) {