]> granicus.if.org Git - clang/commitdiff
avoid accessing off the end of identifiers.
authorChris Lattner <sabre@nondot.org>
Wed, 10 Oct 2007 20:59:57 +0000 (20:59 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 10 Oct 2007 20:59:57 +0000 (20:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42841 91177308-0d34-0410-b5e6-96231b3b80d8

Basic/IdentifierTable.cpp

index 51abcd22b58f2f360ecb6492ecf532dd9fbdc901..7c2681615fc2afb745350bd588e09d3cbe0f694e 100644 (file)
@@ -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;