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

Closes #367
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

View File

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

View File

@ -440,12 +440,14 @@ namespace hex::pl {
}
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;
}
private:
PatternData *m_pointedAt;
PatternData *m_pointedAt = nullptr;
u64 m_pointerBase = 0;
};