From 2e90abd2c574c8aab06aaa6b4ac56d289a466ab4 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 10 Dec 2021 18:53:19 +0100 Subject: [PATCH] patterns: Fix indexing of static arrays --- plugins/libimhex/include/hex/pattern_language/ast_node.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index f3bd9192e..fc8e8e4b6 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -1647,9 +1647,9 @@ namespace hex::pl { LogConsole::abortEvaluation("array index out of bounds", this); auto newPattern = searchScope.front()->clone(); + newPattern->setOffset(staticArrayPattern->getOffset() + index * staticArrayPattern->getTemplate()->getSize()); delete currPattern; currPattern = newPattern; - currPattern->setOffset(staticArrayPattern->getOffset() + index * staticArrayPattern->getSize()); } } }, index->getValue());