1
0
mirror of synced 2025-02-27 14:49:16 +01:00

patterns: Potentially fix issues with nested pointers with custom base addresses

Closes 
This commit is contained in:
WerWolv 2021-12-31 11:05:02 +01:00
parent 490eaef5c1
commit f45cc3fc73
2 changed files with 6 additions and 4 deletions
plugins/libimhex/include/hex/pattern_language

@ -1138,6 +1138,8 @@ namespace hex::pl {
auto pattern = new PatternDataPointer(offset, sizePattern->getSize(), evaluator); auto pattern = new PatternDataPointer(offset, sizePattern->getSize(), evaluator);
pattern->setVariableName(this->m_name); pattern->setVariableName(this->m_name);
applyVariableAttributes(evaluator, this, pattern);
offset = evaluator->dataOffset(); offset = evaluator->dataOffset();
{ {
@ -1155,8 +1157,6 @@ namespace hex::pl {
evaluator->dataOffset() = offset; evaluator->dataOffset() = offset;
applyVariableAttributes(evaluator, this, pattern);
return { pattern }; return { pattern };
} }

@ -440,12 +440,14 @@ namespace hex::pl {
} }
void rebase(u64 base) { void rebase(u64 base) {
this->m_pointedAt->setOffset((this->m_pointedAt->getOffset() - this->m_pointerBase) + base); if (this->m_pointedAt != nullptr)
this->m_pointedAt->setOffset((this->m_pointedAt->getOffset() - this->m_pointerBase) + base);
this->m_pointerBase = base; this->m_pointerBase = base;
} }
private: private:
PatternData *m_pointedAt; PatternData *m_pointedAt = nullptr;
u64 m_pointerBase = 0; u64 m_pointerBase = 0;
}; };