From 3dfff3c754e7607d3131bd4be67314e577a0522d Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 11 Nov 2020 11:56:24 +0100 Subject: [PATCH] Don't try to hash more bytes than the file contains --- source/views/view_hashes.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/views/view_hashes.cpp b/source/views/view_hashes.cpp index 52b2c0f05..f308d6b62 100644 --- a/source/views/view_hashes.cpp +++ b/source/views/view_hashes.cpp @@ -40,6 +40,10 @@ namespace hex { ImGui::InputInt("End", &this->m_hashEnd, 0, 0, ImGuiInputTextFlags_CharsHexadecimal); + size_t dataSize = this->m_dataProvider->getSize(); + if (this->m_hashEnd >= dataSize) + this->m_hashEnd = dataSize - 1; + ImGui::NewLine(); ImGui::Separator(); ImGui::NewLine();