[Lldb-commits] [PATCH] D33853: Avoid invalid string access in ObjCLanguage::MethodName::SetName
Stephane Sezer via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 2 15:22:07 PDT 2017
sas created this revision.
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 at fb.com>
https://reviews.llvm.org/D33853
Files:
source/Plugins/Language/ObjC/ObjCLanguage.cpp
Index: source/Plugins/Language/ObjC/ObjCLanguage.cpp
===================================================================
--- source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -95,7 +95,7 @@
// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33853.101284.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170602/b14f76ac/attachment.bin>
More information about the lldb-commits
mailing list