[Lldb-commits] [lldb] r368444 - [lldb][NFC] Assert on invalid cursors positions when creating CompletionRequest

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 9 07:32:50 PDT 2019


Author: teemperor
Date: Fri Aug  9 07:32:50 2019
New Revision: 368444

URL: http://llvm.org/viewvc/llvm-project?rev=368444&view=rev
Log:
[lldb][NFC] Assert on invalid cursors positions when creating CompletionRequest

Before we just triggered undefined behavior on invalid positions.

Modified:
    lldb/trunk/source/Utility/CompletionRequest.cpp

Modified: lldb/trunk/source/Utility/CompletionRequest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CompletionRequest.cpp?rev=368444&r1=368443&r2=368444&view=diff
==============================================================================
--- lldb/trunk/source/Utility/CompletionRequest.cpp (original)
+++ lldb/trunk/source/Utility/CompletionRequest.cpp Fri Aug  9 07:32:50 2019
@@ -16,6 +16,7 @@ CompletionRequest::CompletionRequest(llv
                                      CompletionResult &result)
     : m_command(command_line), m_raw_cursor_pos(raw_cursor_pos),
       m_result(result) {
+  assert(raw_cursor_pos <= command_line.size() && "Out of bounds cursor?");
 
   // We parse the argument up to the cursor, so the last argument in
   // parsed_line is the one containing the cursor, and the cursor is after the




More information about the lldb-commits mailing list