[Lldb-commits] [PATCH] D68677: protect libedit and LLDB gui from receiving null FILE* streams

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 11:45:51 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG609010d0631a: protect libedit and LLDB gui from receiving null FILE* streams (authored by lawrence_danna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68677/new/

https://reviews.llvm.org/D68677

Files:
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Core/IOHandler.cpp


Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -266,7 +266,8 @@
 #ifndef LLDB_DISABLE_LIBEDIT
   bool use_editline = false;
 
-  use_editline = m_input_sp && m_input_sp->GetIsRealTerminal();
+  use_editline = GetInputFILE() && GetOutputFILE() && GetErrorFILE() &&
+                 m_input_sp && m_input_sp->GetIsRealTerminal();
 
   if (use_editline) {
     m_editline_up.reset(new Editline(editline_name, GetInputFILE(),
Index: lldb/source/Commands/CommandObjectGUI.cpp
===================================================================
--- lldb/source/Commands/CommandObjectGUI.cpp
+++ lldb/source/Commands/CommandObjectGUI.cpp
@@ -29,7 +29,9 @@
     Debugger &debugger = GetDebugger();
 
     File &input = debugger.GetInputFile();
-    if (input.GetIsRealTerminal() && input.GetIsInteractive()) {
+    File &output = debugger.GetOutputFile();
+    if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() &&
+        input.GetIsInteractive()) {
       IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
       if (io_handler_sp)
         debugger.PushIOHandler(io_handler_sp);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68677.224116.patch
Type: text/x-patch
Size: 1241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191009/8ae381d1/attachment.bin>


More information about the lldb-commits mailing list