From e3a6ac548b09b5f67bf18738190a631c36d3cb38 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 5 Oct 2021 21:55:30 +0200 Subject: [PATCH] pattern: Make current data offset in attributes point to start address of pattern --- plugins/libimhex/include/hex/pattern_language/ast_node.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index 71e5cb3ce..bd9ca0672 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -561,6 +561,10 @@ namespace hex::pl { }; inline void applyVariableAttributes(Evaluator *evaluator, const Attributable *attributable, PatternData *pattern) { + auto endOffset = evaluator->dataOffset(); + evaluator->dataOffset() = pattern->getOffset(); + ON_SCOPE_EXIT { evaluator->dataOffset() = endOffset; }; + for (ASTNodeAttribute *attribute : attributable->getAttributes()) { auto &name = attribute->getAttribute(); auto value = attribute->getValue();