[clang] [analyzer] Fix StdLibraryFunctionsChecker crash on surprising sink node (PR #66109)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 02:22:17 PDT 2023


================
@@ -1427,8 +1427,13 @@ void StdLibraryFunctionsChecker::checkPostCall(const CallEvent &Call,
             });
         Pred = C.addTransition(NewState, Pred, Tag);
       }
-      if (!Pred)
+      if (!Pred || Pred->isSink()) {
+        // Pred may be:
+        //  - a nullpointer, when the generated node is not new;
+        //  - a sink, when NewState is posteriorly overconstrained.
+        // In these situations we cannot add the errno note tag.
----------------
balazske wrote:

I like more if the comment is added before the `if` and the braces are not added.

https://github.com/llvm/llvm-project/pull/66109


More information about the cfe-commits mailing list