From 4c7aa4a31f397fdd36cadf72e58116ea43834339 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Fri, 9 Oct 2020 13:59:22 +0200 Subject: [PATCH] Fix a bug in the rva to offset conversion --- StaticEngine/Emulator.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/StaticEngine/Emulator.h b/StaticEngine/Emulator.h index 4232b11..079d552 100644 --- a/StaticEngine/Emulator.h +++ b/StaticEngine/Emulator.h @@ -515,7 +515,10 @@ public: __debugbreak(); //return 0; if (!found->second.pe->IsValidPe()) __debugbreak(); //return 0; - return found->second.pe->ConvertRvaToOffset(uint32(AddressToConvert)); + auto offset = found->second.pe->ConvertRvaToOffset(uint32(AddressToConvert)); + if (offset == INVALID_VALUE) + return 0; + return ReturnType ? FileMapVA + offset : offset; } template