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

2024-04-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed 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

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

2024-04-17 Thread Balazs Benics via cfe-commits
steakhal wrote: The `dyn_cast` fix was committed as e096c144921daba59963f15e89d2ca6fb32d3a78. The CDM:CLibrary matching mode is committed right after that as 024281d4d26344f9613b9115ea1fcbdbdba23235. I'll propose the `dyn_cast` patch for backporting, but leave the other.

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

2024-04-16 Thread Balazs Benics 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)

[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-15 Thread via cfe-commits
https://github.com/NagyDonat edited 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

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

2024-04-15 Thread via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for introducing `CDM::CLibrary` in this checker. However, for the backporting note that this commit depends on two recently added commits: [1] https://github.com/llvm/llvm-project/pull/83432 -- this introduces

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

2024-04-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/88536 >From 915ab37028067fb38ffa69ae5c9726bb8c971436 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Fri, 12 Apr 2024 19:07:49 +0200 Subject: [PATCH 1/2] [analyzer] Harden security.cert.env.InvalidPtr checker fn

[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

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

2024-04-12 Thread Balazs Benics via cfe-commits
steakhal wrote: @iillyyaa, do you wish this crash fix to be backported to clang-18? Or you are fine with only having it in clang-19? https://github.com/llvm/llvm-project/pull/88536 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-04-12 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 Author: Balazs Benics (steakhal) Changes Fixes #88181 I'm also hardening an llvm::cast along the way. Here is the full stack trace of the original crash: https://godbolt.org/z/jn93q39b5 --- Full diff:

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

2024-04-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/88536 Fixes #88181 I'm also hardening an llvm::cast along the way. Here is the full stack trace of the original crash: https://godbolt.org/z/jn93q39b5 >From 915ab37028067fb38ffa69ae5c9726bb8c971436 Mon Sep 17