1
0
mirror of synced 2025-01-29 19:17:28 +01:00

fix: Provider not having any valid regions by default

This commit is contained in:
WerWolv 2023-12-27 11:31:25 +01:00
parent 37d60411bb
commit af5b871383
2 changed files with 5 additions and 11 deletions

View File

@ -35,15 +35,6 @@ namespace hex::prv {
[[nodiscard]] std::string getName() const override { return ""; }
[[nodiscard]] std::string getTypeName() const override { return "MemoryProvider"; }
std::pair<Region, bool> getRegionValidity(u64 address) const {
address -= this->getBaseAddress();
if (address < this->getActualSize())
return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true };
else
return { Region::Invalid(), false };
}
private:
void renameFile();

View File

@ -230,8 +230,11 @@ namespace hex::prv {
}
std::pair<Region, bool> Provider::getRegionValidity(u64 address) const {
if ((address - this->getBaseAddress()) > this->getActualSize())
return { Region::Invalid(), false };
u64 absoluteAddress = address - this->getBaseAddress();
if (absoluteAddress < this->getActualSize())
return { Region { this->getBaseAddress() + absoluteAddress, this->getActualSize() - absoluteAddress }, true };
bool insideValidRegion = false;