From: Chris Lattner Date: Wed, 10 Oct 2007 20:59:57 +0000 (+0000) Subject: avoid accessing off the end of identifiers. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a31f030d5c2bca6567ecfc7fa9367aeb19de7037;p=clang avoid accessing off the end of identifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42841 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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;