From 0167e064f3ae2956ca04511fe19344a30a9141c7 Mon Sep 17 00:00:00 2001 From: Kate Stone Date: Wed, 6 Jan 2016 00:33:07 +0000 Subject: Addresses an unsigned underflow situation that can occur when dumping an empty command history. One example where this occurs in practice is starting the Swift REPL and typing ":command history" since REPL commands aren't stored in the LLDB command prompt history. llvm-svn: 256888 --- lldb/source/Interpreter/CommandHistory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Interpreter/CommandHistory.cpp') diff --git a/lldb/source/Interpreter/CommandHistory.cpp b/lldb/source/Interpreter/CommandHistory.cpp index bbe64b446ac..9d3c814697b 100644 --- a/lldb/source/Interpreter/CommandHistory.cpp +++ b/lldb/source/Interpreter/CommandHistory.cpp @@ -130,9 +130,9 @@ CommandHistory::Dump (Stream& stream, size_t stop_idx) const { Mutex::Locker locker(m_mutex); - stop_idx = std::min(stop_idx, m_history.size() - 1); + stop_idx = std::min(stop_idx + 1, m_history.size()); for (size_t counter = start_idx; - counter <= stop_idx; + counter < stop_idx; counter++) { const std::string hist_item = m_history[counter]; -- cgit v1.2.3