diff --git a/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp b/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp index f989c4243..a7be3654c 100644 --- a/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp +++ b/plugins/libimhex/include/hex/pattern_language/pattern_data.hpp @@ -689,10 +689,13 @@ namespace hex::pl { } void setOffset(u64 offset) override { - for (auto &entry : this->m_entries) { - entry->setOffset(offset + (entry->getOffset() - this->getOffset())); + if (!this->isLocal()) { + for (auto &entry : this->m_entries) { + entry->setOffset(offset + (entry->getOffset() - this->getOffset())); + } } + PatternData::setOffset(offset); } @@ -956,8 +959,10 @@ namespace hex::pl { } void setOffset(u64 offset) override { - for (auto &member : this->m_members) { - member->setOffset(offset + (member->getOffset() - this->getOffset())); + if (!this->isLocal()) { + for (auto &member: this->m_members) { + member->setOffset(offset + (member->getOffset() - this->getOffset())); + } } PatternData::setOffset(offset); @@ -1093,8 +1098,10 @@ namespace hex::pl { } void setOffset(u64 offset) override { - for (auto &member : this->m_members) { - member->setOffset(offset + (member->getOffset() - this->getOffset())); + if (!this->isLocal()) { + for (auto &member: this->m_members) { + member->setOffset(offset + (member->getOffset() - this->getOffset())); + } } PatternData::setOffset(offset); diff --git a/plugins/libimhex/source/pattern_language/evaluator.cpp b/plugins/libimhex/source/pattern_language/evaluator.cpp index 798c49668..4189bf419 100644 --- a/plugins/libimhex/source/pattern_language/evaluator.cpp +++ b/plugins/libimhex/source/pattern_language/evaluator.cpp @@ -39,8 +39,8 @@ namespace hex::pl { } pattern->setVariableName(name); - pattern->setOffset(this->getStack().size()); pattern->setLocal(true); + pattern->setOffset(this->getStack().size()); this->getStack().emplace_back(); variables.push_back(pattern);