[llvm-branch-commits] [lldb] r367534 - Merging r367308:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 1 02:40:07 PDT 2019


Author: hans
Date: Thu Aug  1 02:40:07 2019
New Revision: 367534

URL: http://llvm.org/viewvc/llvm-project?rev=367534&view=rev
Log:
Merging r367308:
------------------------------------------------------------------------
r367308 | teemperor | 2019-07-30 14:31:24 +0200 (Tue, 30 Jul 2019) | 27 lines

[lldb] Fix crash when tab-completing in multi-line expr

Summary:
Tab completing inside the multiline expression command can cause LLDB to crash. The easiest way
to do this is to go inside a frame with at least one local variable and then try to complete:

    (lldb) expr
    1. a[tab]

Reason for this was some mixup when we calculate the cursor position. Obviously we should calculate
the offset inside the string by doing 'end - start', but we are doing 'start - end' (which causes the offset to
become -1 which will lead to some out-of-bounds reading).

Fixes rdar://51754005

I don't see any way to test this as the *multiline* expression completion is completely untested at the moment
and I don't think we have any existing code for testing infrastructure for it.

Reviewers: shafik, davide, labath

Reviewed By: labath

Subscribers: abidh, lldb-commits, davide, clayborg, labath

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D64995
------------------------------------------------------------------------

Added:
    lldb/branches/release_90/packages/Python/lldbsuite/test/expression_command/multiline-completion/
      - copied from r367308, lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/
Modified:
    lldb/branches/release_90/   (props changed)
    lldb/branches/release_90/source/Core/IOHandler.cpp

Propchange: lldb/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug  1 02:40:07 2019
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:366433,366985,367414
+/lldb/trunk:366433,366985,367308,367414

Modified: lldb/branches/release_90/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_90/source/Core/IOHandler.cpp?rev=367534&r1=367533&r2=367534&view=diff
==============================================================================
--- lldb/branches/release_90/source/Core/IOHandler.cpp (original)
+++ lldb/branches/release_90/source/Core/IOHandler.cpp Thu Aug  1 02:40:07 2019
@@ -233,7 +233,7 @@ int IOHandlerDelegate::IOHandlerComplete
         matches, descriptions);
   case Completion::Expression: {
     CompletionResult result;
-    CompletionRequest request(current_line, current_line - cursor,
+    CompletionRequest request(current_line, cursor - current_line,
                               skip_first_n_matches, max_matches, result);
     CommandCompletions::InvokeCommonCompletionCallbacks(
         io_handler.GetDebugger().GetCommandInterpreter(),




More information about the llvm-branch-commits mailing list