1
0
mirror of synced 2024-11-28 01:20:51 +01:00

fix: Parent offset calculation with non-zero base addresses

This commit is contained in:
WerWolv 2024-07-26 19:43:15 +02:00
parent d097f6ada0
commit a8ad045248

View File

@ -1529,9 +1529,11 @@ namespace hex::plugin::builtin {
ImGui::Unindent(); ImGui::Unindent();
{ {
const auto provider = ImHexApi::Provider::get();
const auto baseAddress = provider != nullptr ? provider->getBaseAddress() : 0x00;
const auto parent = pattern->getParent(); const auto parent = pattern->getParent();
const auto parentAddress = parent == nullptr ? 0x00 : parent->getOffset(); const auto parentAddress = parent == nullptr ? baseAddress : parent->getOffset();
const auto parentSize = parent == nullptr ? 0x00 : parent->getSize(); const auto parentSize = parent == nullptr ? baseAddress : parent->getSize();
const auto patternAddress = pattern->getOffset(); const auto patternAddress = pattern->getOffset();
if (patternAddress >= parentAddress && patternAddress + pattern->getSize() <= parentAddress + parentSize) { if (patternAddress >= parentAddress && patternAddress + pattern->getSize() <= parentAddress + parentSize) {