From 88a12f72dcb3076893e8fd8f47d80d3d5cb0fdca Mon Sep 17 00:00:00 2001 From: hasherezade Date: Fri, 23 Sep 2022 04:18:38 +0200 Subject: [PATCH] [BUGFIX] If trying to convert RAW to RAW -> check bounds --- parser/Executable.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/parser/Executable.cpp b/parser/Executable.cpp index e7025ab1..723d9c76 100644 --- a/parser/Executable.cpp +++ b/parser/Executable.cpp @@ -88,17 +88,20 @@ offset_t Executable::toRaw(offset_t offset, addr_type aT, bool allowExceptions) return INVALID_ADDR; } - offset_t convertedOffset = INVALID_ADDR; - if (aT == Executable::RAW) { + if (offset >= this->getRawSize()) { + return INVALID_ADDR; + } //no need to convert return offset; - } + } if (aT == Executable::VA) { offset = VaToRva(offset, false); aT = Executable::RVA; - } + } + + offset_t convertedOffset = INVALID_ADDR; if (aT == Executable::RVA){ try { convertedOffset = this->rvaToRaw(offset);