llvm-project/lldb
Pavel Labath 38c2059aec Fix segfault resulting from empty print prompt
Summary:
I have found a way to segfault lldb in 7 keystrokes! Steps to reproduce:
1) Launch lldb
2) Type `print` and hit enter. lldb will now prompt you to type a list of
    expressions, followed by an empty line.
3) Hit enter, indicating the end of your input.
4) Segfault!

After some investigation, I've found the issue in Host/common/Editline.cpp.
Editline::MoveCursor() relies on m_input_lines not being empty when the `to`
argument is CursorPosition::BlockEnd. This scenario, as far as I can tell,
occurs in one specific instance: In Editline::EndOrAddLineCommand() when the
list of lines being processed contains exactly one string (""). Meeting this
condition is fairly simple, I have posted steps to reproduce above.

Reviewers: krytarowski, zturner, labath

Reviewed By: labath

Subscribers: scott.smith, lldb-commits

Differential Revision: https://reviews.llvm.org/D32421
Patch by Alex Langford.

llvm-svn: 302225
2017-05-05 11:51:21 +00:00
..
cmake [CMake] Abstract Config.h generation for Xcode 2017-04-27 16:04:26 +00:00
docs Fix a race condition in FuncUnwinders where the mutex was being 2017-02-24 03:35:46 +00:00
examples Add an example command to toggle between disassembly-only and source mode. 2017-04-20 21:51:27 +00:00
include/lldb Add TaskMap for iterating a function over a set of integers 2017-05-05 11:16:59 +00:00
lit [test] Fix finding LLDB tools when building stand-alone 2017-02-19 22:11:38 +00:00
lldb.xcodeproj Public headers need to be public. 2017-04-28 21:03:18 +00:00
lldb.xcworkspace Revert r275223, which committed the wrong thing. 2016-07-12 23:31:42 +00:00
packages/Python/lldbsuite Fix segfault resulting from empty print prompt 2017-05-05 11:51:21 +00:00
resources Bump the lldb version # in the xcode project files from 2016-03-15 04:36:11 +00:00
scripts [LLDB][MIPS] Fix TestStepOverBreakpoint.py failure. 2017-05-04 11:34:42 +00:00
source Fix segfault resulting from empty print prompt 2017-05-05 11:51:21 +00:00
test [CMake] Override debugserver to use the build tree on Darwin 2017-03-14 20:04:46 +00:00
third_party/Python/module *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
tools Re-landing IPv6 support for LLDB Host 2017-04-26 23:17:20 +00:00
unittests Add TaskMap for iterating a function over a set of integers 2017-05-05 11:16:59 +00:00
utils *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
www Remove the home-grown android toolchain file and all references to it 2017-04-25 12:58:49 +00:00
.arcconfig Upgrade all the .arcconfigs to https. 2016-07-14 13:15:37 +00:00
.clang-format Updated .clang-format rules so bring LLDB in line with LLVM standards. 2016-09-06 17:19:00 +00:00
.gitignore test infra: clear file-charged issues on rerun of file 2016-10-01 00:17:08 +00:00
CMakeLists.txt [CMake] Abstract Config.h generation for Xcode 2017-04-27 16:04:26 +00:00
CODE_OWNERS.txt Greg Clayton is no longer working at Apple, he will continue to 2017-03-01 00:00:45 +00:00
INSTALL.txt Changed builld-llvm.py to use .json files 2017-02-23 02:21:34 +00:00
LICENSE.TXT
use_lldb_suite_root.py *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00