From e8dea98b5e3f93b32875cfa178537dba2efdf5ae Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Wed, 25 Apr 2012 17:46:01 +0000 Subject: [PATCH] Hardened LLDB against NULL identifiers being passed into FindExternalVisibleDeclsByName. llvm-svn: 155561 --- lldb/source/Expression/ClangASTSource.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 5461f1918c70..4c31c223b89c 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -76,8 +76,15 @@ ClangASTSource::FindExternalVisibleDeclsByName switch (clang_decl_name.getNameKind()) { // Normal identifiers. case DeclarationName::Identifier: - if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0) - return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name); + { + clang::IdentifierInfo *identifier_info = clang_decl_name.getAsIdentifierInfo(); + + if (!identifier_info || + identifier_info->getBuiltinID() != 0) + { + return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name); + } + } break; // Operator names. Not important for now.