[clang] [analyzer] Harden security.cert.env.InvalidPtr checker fn matching (PR #88536)

2024-04-12 Thread Ilya A. Kriveshko via cfe-commits
iillyyaa wrote: @steakhal, thank you for the quick turnaround with the fix! > @iillyyaa, do you wish this crash fix to be backported to clang-18? Or you > are fine with only having it in clang-19? A backport for the next point release of 18 would be very much appreciated. We are using the sca

[clang] [analyzer] Harden security.cert.env.InvalidPtr checker fn matching (PR #88536)

2024-04-16 Thread Ilya A. Kriveshko via cfe-commits
@@ -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(RetVal.getAsRegion()); + if (!SymRegOfRetVal)

[clang] [analyzer] Harden security.cert.env.InvalidPtr checker fn matching (PR #88536)

2024-04-16 Thread Ilya A. Kriveshko via cfe-commits
@@ -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(RetVal.getAsRegion()); + if (!SymRegOfRetVal)