[BUGFIX] If trying to convert RAW to RAW -> check bounds

This commit is contained in:
hasherezade
2022-09-23 04:18:38 +02:00
parent 31b4c6b74c
commit 88a12f72dc
+7 -4
View File
@@ -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);