mirror of
https://github.com/hasherezade/bearparser
synced 2026-06-08 14:32:38 +00:00
[BUGFIX] If trying to convert RAW to RAW -> check bounds
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user