From 0e40b8a81a0c9890a45914c948172d07ee054dae Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 9 Feb 2022 08:55:51 +0100 Subject: [PATCH] pattern: Don't reset offset back after variable placements in global scope --- lib/libimhex/include/hex/pattern_language/ast_node.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libimhex/include/hex/pattern_language/ast_node.hpp b/lib/libimhex/include/hex/pattern_language/ast_node.hpp index 01521fb91..f1b2bf384 100644 --- a/lib/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/lib/libimhex/include/hex/pattern_language/ast_node.hpp @@ -859,7 +859,7 @@ namespace hex::pl { applyVariableAttributes(evaluator, this, pattern); - if (this->m_placementOffset != nullptr) { + if (this->m_placementOffset != nullptr && !evaluator->isGlobalScope()) { evaluator->dataOffset() = startOffset; } @@ -943,7 +943,7 @@ namespace hex::pl { applyVariableAttributes(evaluator, this, pattern); - if (this->m_placementOffset != nullptr) { + if (this->m_placementOffset != nullptr && !evaluator->isGlobalScope()) { evaluator->dataOffset() = startOffset; } @@ -1259,7 +1259,7 @@ namespace hex::pl { pattern->setEndian(sizePattern->getEndian()); } - if (this->m_placementOffset != nullptr) { + if (this->m_placementOffset != nullptr && !evaluator->isGlobalScope()) { evaluator->dataOffset() = startOffset; } else { evaluator->dataOffset() = pointerEndOffset;