1
0
mirror of synced 2024-11-28 17:40:51 +01:00

fix: Searching for invalid binary sequence causing too many matches

This commit is contained in:
WerWolv 2022-09-13 14:05:48 +02:00
parent 7d87c8bb98
commit 8c219b981c

View File

@ -234,6 +234,9 @@ namespace hex::plugin::builtin {
reader.setEndAddress(searchRegion.getEndAddress());
auto sequence = hex::decodeByteString(settings.sequence);
if (sequence.empty())
return { };
auto occurrence = reader.begin();
while (true) {
occurrence = std::search(reader.begin(), reader.end(), std::boyer_moore_horspool_searcher(sequence.begin(), sequence.end()));
@ -461,7 +464,7 @@ namespace hex::plugin::builtin {
ImGui::InputText("hex.builtin.common.value"_lang, settings.sequence);
this->m_settingsValid = !settings.sequence.empty();
this->m_settingsValid = !settings.sequence.empty() && !hex::decodeByteString(settings.sequence).empty();
ImGui::EndTabItem();
}