[clang] [analyzer] Fix nullptr dereference for symbols from pointer invalidation (PR #106568)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 08:26:36 PDT 2024


================
@@ -126,3 +126,22 @@ void caller_for_nested_leaking() {
   int *ptr = 0;
   caller_mid_for_nested_leaking(&ptr);
 }
+
+// This used to crash StackAddrEscapeChecker because
+// it features a symbol conj_$1{struct c *, LC1, S763, #1}
+// that has no origin region.
+// bbi-98571
+struct a {
+  int member;
+};
+
+struct c {
+  struct a *nested_ptr;
+};
+long global_var;
+void opaque(struct c*);
+void bbi_98571_no_crash() {
+  struct c *ptr = (struct c *)global_var;
+  opaque(ptr);
+  ptr->nested_ptr->member++;
----------------
steakhal wrote:

Did it crash at this line? If so, mark it with zhe no-crash comment.

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


More information about the cfe-commits mailing list