diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index 693f3b708b..2eef357b15 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -217,7 +217,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event) auto byte_y = (absolute_y - hex_start_y) / line_height(); auto offset = (byte_y * m_bytes_per_row) + byte_x; - if (offset < 0 || offset > static_cast(m_buffer.size())) + if (offset < 0 || offset >= static_cast(m_buffer.size())) return; #ifdef HEX_DEBUG @@ -239,7 +239,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event) auto byte_y = (absolute_y - text_start_y) / line_height(); auto offset = (byte_y * m_bytes_per_row) + byte_x; - if (offset < 0 || offset > static_cast(m_buffer.size())) + if (offset < 0 || offset >= static_cast(m_buffer.size())) return; #ifdef HEX_DEBUG