aboutsummaryrefslogtreecommitdiff
path: root/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-10 20:59:57 +0000
committerChris Lattner <sabre@nondot.org>2007-10-10 20:59:57 +0000
commita31f030d5c2bca6567ecfc7fa9367aeb19de7037 (patch)
tree118758e31cfbf556b8b5218af39878036c7748a1 /Basic/IdentifierTable.cpp
parent2d85f8ba62fd6fdcf0ae303d77112b413d412cae (diff)
avoid accessing off the end of identifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/IdentifierTable.cpp')
-rw-r--r--Basic/IdentifierTable.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Basic/IdentifierTable.cpp b/Basic/IdentifierTable.cpp
index 51abcd22b5..7c2681615f 100644
--- a/Basic/IdentifierTable.cpp
+++ b/Basic/IdentifierTable.cpp
@@ -157,6 +157,7 @@ tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
return memcmp(Name, #NAME, LEN) ? tok::pp_not_keyword : tok::pp_ ## NAME
unsigned Len = getLength();
+ if (Len < 2) return tok::pp_not_keyword;
const char *Name = getName();
switch (HASH(Len, Name[0], Name[2])) {
default: return tok::pp_not_keyword;