https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/122915
I cannot minial produce it, but when I run clangd with `misc-const-correctness` check in a big project clangd crashed due to deref nullptr here. There are suspicious code in clang which may pass a nullptr to `InitExprs` >From d0a1dd69e4681b30c8080c09d49e519aa178c989 Mon Sep 17 00:00:00 2001 From: Congcong Cai <congcongcai0...@163.com> Date: Tue, 14 Jan 2025 23:16:23 +0800 Subject: [PATCH] [mutation analyzer] enhance stability for `hasAnyInit` matcher I cannot minial produce it, but when I run clangd with `misc-const-correctness` check in a big project clangd crashed due to deref nullptr here. There are suspicious code in clang which may pass a nullptr to `InitExprs` --- clang/lib/Analysis/ExprMutationAnalyzer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Analysis/ExprMutationAnalyzer.cpp b/clang/lib/Analysis/ExprMutationAnalyzer.cpp index 53b838e9ede4d7..cefe64409c9776 100644 --- a/clang/lib/Analysis/ExprMutationAnalyzer.cpp +++ b/clang/lib/Analysis/ExprMutationAnalyzer.cpp @@ -104,6 +104,8 @@ AST_MATCHER_P(Stmt, canResolveToExpr, const Stmt *, Inner) { AST_MATCHER_P(InitListExpr, hasAnyInit, ast_matchers::internal::Matcher<Expr>, InnerMatcher) { for (const Expr *Arg : Node.inits()) { + if (Arg == nullptr) + continue; ast_matchers::internal::BoundNodesTreeBuilder Result(*Builder); if (InnerMatcher.matches(*Arg, Finder, &Result)) { *Builder = std::move(Result); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits