[Lldb-commits] [lldb] r361078 - [EditLine] Check string pointers before dereferencing them.
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Fri May 17 14:49:17 PDT 2019
Author: davide
Date: Fri May 17 14:49:17 2019
New Revision: 361078
URL: http://llvm.org/viewvc/llvm-project?rev=361078&view=rev
Log:
[EditLine] Check string pointers before dereferencing them.
Get*AtIndex() can return nullptr. This only happens in the swift
REPL support, so it's hard to test upstream.
<rdar://problem/50875178>
Modified:
lldb/trunk/source/Host/common/Editline.cpp
Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=361078&r1=361077&r2=361078&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Fri May 17 14:49:17 2019
@@ -870,10 +870,11 @@ static void PrintCompletion(FILE *output
const char *completion_str = completions.GetStringAtIndex(i);
const char *description_str = descriptions.GetStringAtIndex(i);
- fprintf(output_file, "\n\t%-*s", max_len, completion_str);
+ if (completion_str)
+ fprintf(output_file, "\n\t%-*s", max_len, completion_str);
// Print the description if we got one.
- if (strlen(description_str))
+ if (description_str && strlen(description_str))
fprintf(output_file, " -- %s", description_str);
}
}
More information about the lldb-commits
mailing list