[cfe-commits] r42841 - /cfe/trunk/Basic/IdentifierTable.cpp

Chris Lattner sabre at nondot.org
Wed Oct 10 13:59:57 PDT 2007


Author: lattner
Date: Wed Oct 10 15:59:57 2007
New Revision: 42841

URL: http://llvm.org/viewvc/llvm-project?rev=42841&view=rev
Log:
avoid accessing off the end of identifiers.

Modified:
    cfe/trunk/Basic/IdentifierTable.cpp

Modified: cfe/trunk/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/IdentifierTable.cpp?rev=42841&r1=42840&r2=42841&view=diff

==============================================================================
--- cfe/trunk/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/Basic/IdentifierTable.cpp Wed Oct 10 15:59:57 2007
@@ -157,6 +157,7 @@
     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;





More information about the cfe-commits mailing list