diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-01-06 00:33:07 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-01-06 00:33:07 +0000 |
commit | 0167e064f3ae2956ca04511fe19344a30a9141c7 (patch) | |
tree | 8209630e80df928830ebb40a6ef4d8b60699f04d /lldb/source/Interpreter/CommandHistory.cpp | |
parent | 03f483353c768409e8ef4d19c5536bb7bcd3c1d7 (diff) | |
download | bcm5719-llvm-0167e064f3ae2956ca04511fe19344a30a9141c7.tar.gz bcm5719-llvm-0167e064f3ae2956ca04511fe19344a30a9141c7.zip |
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
Diffstat (limited to 'lldb/source/Interpreter/CommandHistory.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandHistory.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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]; |