From 9ed5b156a27a972ca1423aa25638f239cdc2ffc0 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 18 Jan 2012 03:41:19 +0000 Subject: Fix a string over-run detected by ASAN. llvm-svn: 148375 --- clang/lib/CodeGen/CodeGenModule.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4f074eb..c2c4d08 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -883,8 +883,9 @@ namespace { unsigned BuiltinID = FD->getBuiltinID(); if (!BuiltinID) return true; - const char *BuiltinName = BI.GetName(BuiltinID) + strlen("__builtin_"); - if (Name == BuiltinName) { + StringRef BuiltinName = BI.GetName(BuiltinID); + if (BuiltinName.startswith("__builtin_") && + Name == BuiltinName.slice(strlen("__builtin_"), StringRef::npos)) { Result = true; return false; } -- cgit v1.1