[Clang] Add sanity check in Sema::getDestructorName to prevent nullptr dereference
authorShafik Yaghmour <shafik.yaghmour@intel.com>
Wed, 25 Jan 2023 18:47:21 +0000 (10:47 -0800)
committerShafik Yaghmour <shafik.yaghmour@intel.com>
Wed, 25 Jan 2023 18:49:04 +0000 (10:49 -0800)
commit6ec446ddcee33777a8420c227374f7b422a7df1b
tree06e7ba0781c9839ff4ac7945edabcb217bf67854
parent5a4a8eb2b63ae3595714144c8eacd9d7156c9088
[Clang] Add sanity check in Sema::getDestructorName to prevent nullptr dereference

Currently in Sema::getDestructorName we call SS.getScopeRep()->getPrefix() but
SS.getScopeRep() can return nullptr because LookupInNestedNameSpec(...) called a
little before can invalidate SS.

This fixes: https://github.com/llvm/llvm-project/issues/59446

Differential Revision: https://reviews.llvm.org/D140598
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/GH59446.cpp [new file with mode: 0644]