forked from OSchip/llvm-project
Avoid invalid string access in ObjCLanguage::MethodName::SetName
Summary: Don't access `name[1] if the string is only of length 1. Avoids a crash/assertion failure when parsing the string `-`. Test Plan: Debug a swift binary, set a breakpoint, watch lldb not crash Original change by Paul Menage <menage@fb.com> Reviewers: lldb-commits, clayborg Differential Revision: https://reviews.llvm.org/D33853 llvm-svn: 304725
This commit is contained in:
parent
d454c73cc3
commit
ca5e153fb1
|
@ -95,7 +95,7 @@ bool ObjCLanguage::MethodName::SetName(llvm::StringRef name, bool strict) {
|
|||
// or '-' can be omitted
|
||||
bool valid_prefix = false;
|
||||
|
||||
if (name[0] == '+' || name[0] == '-') {
|
||||
if (name.size() > 1 && (name[0] == '+' || name[0] == '-')) {
|
||||
valid_prefix = name[1] == '[';
|
||||
if (name[0] == '+')
|
||||
m_type = eTypeClassMethod;
|
||||
|
|
Loading…
Reference in New Issue