diff --git a/lib/libimhex/source/providers/provider.cpp b/lib/libimhex/source/providers/provider.cpp index ccf8d1e2a..cd92c00e4 100644 --- a/lib/libimhex/source/providers/provider.cpp +++ b/lib/libimhex/source/providers/provider.cpp @@ -266,7 +266,7 @@ namespace hex::prv { } std::pair Provider::getRegionValidity(u64 address) const { - if (address < this->getActualSize()) + if (address > this->getActualSize()) return { Region::Invalid(), false }; bool insideValidRegion = false; diff --git a/plugins/builtin/include/content/providers/disk_provider.hpp b/plugins/builtin/include/content/providers/disk_provider.hpp index ee08445f7..db79d8cee 100644 --- a/plugins/builtin/include/content/providers/disk_provider.hpp +++ b/plugins/builtin/include/content/providers/disk_provider.hpp @@ -45,6 +45,8 @@ namespace hex::plugin::builtin::prv { return "hex.builtin.provider.disk"; } + std::pair getRegionValidity(u64 address) const override; + protected: void reloadDrives(); diff --git a/plugins/builtin/include/content/providers/gdb_provider.hpp b/plugins/builtin/include/content/providers/gdb_provider.hpp index adce07db8..2291dc4a2 100644 --- a/plugins/builtin/include/content/providers/gdb_provider.hpp +++ b/plugins/builtin/include/content/providers/gdb_provider.hpp @@ -49,6 +49,8 @@ namespace hex::plugin::builtin::prv { return "hex.builtin.provider.gdb"; } + std::pair getRegionValidity(u64 address) const override; + protected: hex::Socket m_socket; diff --git a/plugins/builtin/source/content/providers/disk_provider.cpp b/plugins/builtin/source/content/providers/disk_provider.cpp index 6433c29fd..801564a5f 100644 --- a/plugins/builtin/source/content/providers/disk_provider.cpp +++ b/plugins/builtin/source/content/providers/disk_provider.cpp @@ -357,4 +357,11 @@ namespace hex::plugin::builtin::prv { this->reloadDrives(); } + std::pair DiskProvider::getRegionValidity(u64 address) const { + if (address < this->getActualSize()) + return { Region { address, this->getActualSize() - address }, true }; + else + return { Region::Invalid(), false }; + } + } \ No newline at end of file diff --git a/plugins/builtin/source/content/providers/gdb_provider.cpp b/plugins/builtin/source/content/providers/gdb_provider.cpp index 06ed2e146..f41626b5c 100644 --- a/plugins/builtin/source/content/providers/gdb_provider.cpp +++ b/plugins/builtin/source/content/providers/gdb_provider.cpp @@ -324,4 +324,11 @@ namespace hex::plugin::builtin::prv { return Provider::storeSettings(settings); } + std::pair GDBProvider::getRegionValidity(u64 address) const { + if (address < this->getActualSize()) + return { Region { address, this->getActualSize() - address }, true }; + else + return { Region::Invalid(), false }; + } + } \ No newline at end of file diff --git a/plugins/builtin/source/content/providers/intel_hex_provider.cpp b/plugins/builtin/source/content/providers/intel_hex_provider.cpp index 2bd44fa21..a69abf0ea 100644 --- a/plugins/builtin/source/content/providers/intel_hex_provider.cpp +++ b/plugins/builtin/source/content/providers/intel_hex_provider.cpp @@ -221,8 +221,9 @@ namespace hex::plugin::builtin::prv { std::pair IntelHexProvider::getRegionValidity(u64 address) const { auto intervals = this->m_data.findOverlapping(address, address); - if (intervals.empty()) - return { Region::Invalid(), false }; + if (intervals.empty()) { + return Provider::getRegionValidity(address); + } auto closestInterval = intervals.front(); for (const auto &interval : intervals) {