aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/AttributeList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/AttributeList.cpp')
-rw-r--r--lib/Sema/AttributeList.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/AttributeList.cpp b/lib/Sema/AttributeList.cpp
index a3791dedf7..9b74fc03ce 100644
--- a/lib/Sema/AttributeList.cpp
+++ b/lib/Sema/AttributeList.cpp
@@ -101,7 +101,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
StringRef AttrName = Name->getName();
// Normalize the attribute name, __foo__ becomes foo.
- if (AttrName.startswith("__") && AttrName.endswith("__"))
+ if (AttrName.startswith("__") && AttrName.endswith("__") &&
+ AttrName.size() >= 4)
AttrName = AttrName.substr(2, AttrName.size() - 4);
return llvm::StringSwitch<AttributeList::Kind>(AttrName)