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); } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits