fix: Infinite loop when doing forwards/backwards searches in some cases
Fixes #1734
This commit is contained in:
parent
08bb69c048
commit
af59b9d2ca
2
lib/external/libwolv
vendored
2
lib/external/libwolv
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 101da1689211a40c576b9d39d5cd38fa4c3d8c52
|
Subproject commit a34c241303d846b3a080920d7c6b1579522c163d
|
@ -211,11 +211,21 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Region> PopupFind::findByteSequence(const std::vector<u8> &sequence) const {
|
std::optional<Region> PopupFind::findByteSequence(const std::vector<u8> &sequence) const {
|
||||||
|
if (sequence.empty())
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
if (provider == nullptr)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
const auto providerSize = provider->getActualSize();
|
||||||
|
if (providerSize == 0x00)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
prv::ProviderReader reader(provider);
|
prv::ProviderReader reader(provider);
|
||||||
|
|
||||||
auto startAbsolutePosition = provider->getBaseAddress();
|
auto startAbsolutePosition = provider->getBaseAddress();
|
||||||
auto endAbsolutePosition = provider->getBaseAddress() + provider->getActualSize() - 1;
|
auto endAbsolutePosition = provider->getBaseAddress() + providerSize - 1;
|
||||||
|
|
||||||
constexpr static auto searchFunction = [](const auto &haystackBegin, const auto &haystackEnd,
|
constexpr static auto searchFunction = [](const auto &haystackBegin, const auto &haystackEnd,
|
||||||
const auto &needleBegin, const auto &needleEnd) {
|
const auto &needleBegin, const auto &needleEnd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user