summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2019-05-17 21:49:17 +0000
committerDavide Italiano <davide@freebsd.org>2019-05-17 21:49:17 +0000
commit53f68c57646877cba5d946b3f7e1cffb75e8ea5d (patch)
tree74cf075040d1aa5f27413d3fdf0626500ded7784 /lldb
parenta9c7b2583f2f898779a8652bd871158f5085f4a2 (diff)
downloadbcm5719-llvm-53f68c57646877cba5d946b3f7e1cffb75e8ea5d.tar.gz
bcm5719-llvm-53f68c57646877cba5d946b3f7e1cffb75e8ea5d.zip
[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> llvm-svn: 361078
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Host/common/Editline.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index da83de656df..aa52b4ca4f0 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -870,10 +870,11 @@ static void PrintCompletion(FILE *output_file, size_t start, size_t end,
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);
}
}
OpenPOWER on IntegriCloud