================
@@ -205,8 +210,12 @@ void InvalidPtrChecker::postPreviousReturnInvalidatingCall(
       CE, LCtx, CE->getType(), C.blockCount());
   State = State->BindExpr(CE, LCtx, RetVal);
 
+  const auto *SymRegOfRetVal =
+      dyn_cast_or_null<SymbolicRegion>(RetVal.getAsRegion());
+  if (!SymRegOfRetVal)
+    return;
+
   // Remember to this region.
-  const auto *SymRegOfRetVal = cast<SymbolicRegion>(RetVal.getAsRegion());
   const MemRegion *MR = SymRegOfRetVal->getBaseRegion();
----------------
iillyyaa wrote:

If this (and the corresponding clang/test/Analysis/invalid-ptr-checker.cpp 
test) were put into a separate commit from the CDM::CLibrary changes, then this 
commit would be more easily back-ported into llvm:release/18.x branch.

I cannot tell how critical the CDM::CLibrary change is, but I have confirmed 
that the crash I had originally reported in 
https://github.com/llvm/llvm-project/issues/88181 is fixed with just the 
highlighted change when applied to clang18.

https://github.com/llvm/llvm-project/pull/88536
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to