summaryrefslogtreecommitdiffstats
path: root/clang/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
commitd2b8ce42597b63f3fab028965468aff63c207fd9 (patch)
tree6cba6a9f054cb7f018de03e3e7e39ba170f902d1 /clang/Basic/IdentifierTable.cpp
parentdb83d77c78772b0188495093186b88b4ad2ea857 (diff)
downloadbcm5719-llvm-d2b8ce42597b63f3fab028965468aff63c207fd9.tar.gz
bcm5719-llvm-d2b8ce42597b63f3fab028965468aff63c207fd9.zip
avoid accessing off the end of identifiers.
llvm-svn: 42841
Diffstat (limited to 'clang/Basic/IdentifierTable.cpp')
-rw-r--r--clang/Basic/IdentifierTable.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/Basic/IdentifierTable.cpp b/clang/Basic/IdentifierTable.cpp
index 51abcd22b58..7c2681615fc 100644
--- a/clang/Basic/IdentifierTable.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud