[Lldb-commits] [PATCH] D123415: [lldb] Fix crash when a type has no definition

Sigurður Ásgeirsson via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 8 11:13:35 PDT 2022


siggi-alpheus created this revision.
siggi-alpheus added reviewers: labath, jasonmolenda.
siggi-alpheus added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
siggi-alpheus requested review of this revision.
Herald added a subscriber: lldb-commits.

See issue 54761 <https://github.com/llvm/llvm-project/issues/54761>.
It looks like Google Chrome's symbols contain some member functions whose this pointer type is missing, which causes a nullptr access and a crash. This patch makes lldb tolerant of this problem by avoiding the nullptr access.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123415

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -7571,7 +7571,8 @@
   clang::CXXRecordDecl *cxx_record_decl =
       record_qual_type->getAsCXXRecordDecl();
 
-  if (cxx_record_decl == nullptr)
+  // Bail if no declaration or if the declaration has no definition.
+  if (cxx_record_decl == nullptr || !cxx_record_decl->hasDefinition())
     return nullptr;
 
   clang::QualType method_qual_type(ClangUtil::GetQualType(method_clang_type));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123415.421592.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220408/ef7a67a6/attachment-0001.bin>


More information about the lldb-commits mailing list