[clang] [analyzer] Model constructor initializer for an array member (PR #107537)

2024-09-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM. FYI "modelled" should contain only 1 "l" if I'm not mistaken. Also llvm style suggests capitalizing and punctuating comments. None of these are blockers. https://github.com/llvm/llvm-project/pull/107537 _

[clang] [analyzer] Model constructor initializer for an array member (PR #107537)

2024-09-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/107537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Fix #embed crash (PR #107764)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM. I knew about this issue, thanks for the fix! There is more for a proper fix but it's better than crashing. https://github.com/llvm/llvm-project/pull/107764 ___ cfe-commits mailing list cfe-c

[clang] [clang][analyzer] Fix #embed crash (PR #107764)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/107764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Fix #embed crash (PR #107764)

2024-09-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang_analyze_cc1 -std=c23 -analyzer-checker=core,debug.ExprInspection -verify %s + +// expected-no-diagnostics + +int main() { +const unsigned char SelfBytes[] = { +#embed "embed.c" +}; +} steakhal wrote: ```suggestion

[clang] [clang][analyzer] Fix #embed crash (PR #107764)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/107764 >From a43b9b74ac253c0072498007cf56ed57d8255143 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Sun, 8 Sep 2024 11:52:28 -0400 Subject: [PATCH 1/2] [clang][analyzer] Fix #embed crash Fix #107724. --- c

[clang] [clang][analyzer] Fix #embed crash (PR #107764)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/107764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Fix #embed crash (PR #107764)

2024-09-09 Thread Balazs Benics via cfe-commits
steakhal wrote: > PS: Should this be cherry-picked into 19? Requested the backport in https://github.com/llvm/llvm-project/pull/107841 https://github.com/llvm/llvm-project/pull/107764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang][analyzer] Move 'alpha.core.PointerSub' checker into 'core.PointerSub' (PR #107596)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. I'm not satisfied with the quality of the reports. The report refers to `Subtraction of two pointers that do not point into the same array is undefined behavior` without pointing out where the two pointers point to (and/or wher

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
steakhal wrote: LGTM, thanks! https://github.com/llvm/llvm-project/pull/107572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
@@ -2380,8 +2380,16 @@ RegionStoreManager::bind(RegionBindingsConstRef B, Loc L, SVal V) { // Binding directly to a symbolic region should be treated as binding // to element 0. - if (const SymbolicRegion *SR = dyn_cast(R)) -R = GetElementZeroRegion(SR, SR->getPointe

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
@@ -40,3 +40,12 @@ void testInlineAsmMemcpyUninit(void) MyMemcpy(&a[1], &b[1], sizeof(b) - sizeof(b[1])); c = a[0]; // expected-warning{{Assigned value is garbage or undefined}} } + +void *globalPtr; + +void testNoCrash() +{ + // Use global pointer to make it symbolic.

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Let's wait for the premerge tests before merging. https://github.com/llvm/llvm-project/pull/107572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/107572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/107572 >From 0e8db855a1bde0692260f5aa26c245328a358a50 Mon Sep 17 00:00:00 2001 From: Pavel Skripkin Date: Fri, 6 Sep 2024 15:15:52 +0300 Subject: [PATCH 1/2] clang/csa: fix crash on bind to symbolic region with void

[clang] [analyzer] Improve handling of unsigned values in ArrayBoundCheckerV2 (PR #81034)

2024-09-09 Thread Balazs Benics via cfe-commits
steakhal wrote: In this PR, we decided to suppress some reports. It turns out the `alpha.security.ReturnPtrRange` would overtake some the suppressed reports and issue a diagnostic itself. Here is an example: https://compiler-explorer.com/z/P9bGTjv5W ```c++ const char *unwindTerminator(const char

[clang] [analyzer] fix crash on binding to symbolic region with `void *` type (PR #107572)

2024-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/107572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Move 'alpha.core.PointerSub' checker into 'core.PointerSub' (PR #107596)

2024-09-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. > > I'm not satisfied with the quality of the reports. The report refers to > > `Subtraction of two pointers that do not point into the same array is > > undefined behavior` without pointing out where the two pointers point to > > (and/or

[clang] [analyzer][NFC] Trivial refactoring of region invalidation (PR #102456)

2024-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/102456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/102636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-08-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Have you checked the quality of the reports? https://github.com/llvm/llvm-project/pull/102636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Improve documentation of `invalidateRegion` methods (PR #102477)

2024-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM. Do you plan to apply more refactors to invalidation and Store? I'm asking because currently we experiment with a complete Store rewrite - touching there invalidation as well. https://github.com/llvm/llvm-project/pull/102477 _

[clang] [clang][analyzer] Remove array bounds check from PointerSubChecker (PR #102580)

2024-08-09 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. I haven't really checked the PR, but we don't map the PointerSub checker to any rules. Maybe, after it's out of alpha we will come back and check if it makes sense for us :) Thank you wo

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/102602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. Looks pretty good! However, for this to land, we need to try harder to prevent state-splits. We must prove in more cases (at least in simple symbolic cases) that no overflow can happen. But in principle, I like that we do a sp

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -21,16 +21,67 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/Checker

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -verify %s \ +// RUN: -analyzer-checker=core,debug.ExprInspection + +#define NULL ((void *)0) +#define INT_MAX __INT_MAX__ + +void clang_analyzer_dump_int(int); + +void test1(void) +{ + int res; +

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -50,6 +101,44 @@ class BuiltinFunctionChecker : public Checker { } // namespace +void BuiltinFunctionChecker::HandleOverflowBuiltin(const CallEvent &Call, + CheckerContext &C, +

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -21,16 +21,67 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/Checker

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -verify %s \ +// RUN: -analyzer-checker=core,debug.ExprInspection + +#define NULL ((void *)0) +#define INT_MAX __INT_MAX__ + +void clang_analyzer_dump_int(int); + +void test1(void) +{ + int res; + +

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -278,6 +278,23 @@ int *mallocRegion(void) { return mem; } +int *custom_calloc(size_t a, size_t b) { + size_t res; + if (__builtin_mul_overflow(a, b, &res)) +return 0; + + return malloc(res); +} + +int *mallocRegionOverflow(void) { + int *mem = (int*)custom_calloc(

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -21,16 +21,67 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/Checker

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -50,6 +101,44 @@ class BuiltinFunctionChecker : public Checker { } // namespace +void BuiltinFunctionChecker::HandleOverflowBuiltin(const CallEvent &Call, + CheckerContext &C, +

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -278,6 +278,23 @@ int *mallocRegion(void) { return mem; } +int *custom_calloc(size_t a, size_t b) { + size_t res; + if (__builtin_mul_overflow(a, b, &res)) +return 0; + + return malloc(res); steakhal wrote: Have you considered using a ternary oper

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -verify %s \ +// RUN: -analyzer-checker=core,debug.ExprInspection + +#define NULL ((void *)0) +#define INT_MAX __INT_MAX__ + +void clang_analyzer_dump_int(int); + +void test1(void) +{ + int res; + +

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -278,6 +278,23 @@ int *mallocRegion(void) { return mem; } +int *custom_calloc(size_t a, size_t b) { + size_t res; + if (__builtin_mul_overflow(a, b, &res)) +return 0; + + return malloc(res); +} + +int *mallocRegionOverflow(void) { + int *mem = (int*)custom_calloc(

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -verify %s \ +// RUN: -analyzer-checker=core,debug.ExprInspection + +#define NULL ((void *)0) +#define INT_MAX __INT_MAX__ + +void clang_analyzer_dump_int(int); + +void test1(void) +{ + int res; + +

[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
@@ -50,6 +101,44 @@ class BuiltinFunctionChecker : public Checker { } // namespace +void BuiltinFunctionChecker::HandleOverflowBuiltin(const CallEvent &Call, + CheckerContext &C, +

[clang] [analyzer] Model overflow builtins (PR #102602)

2024-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/102602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [analyzer] Delete `alpha.security.MallocOverflow` (PR #103059)

2024-08-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Nuke it! Please note this in the release notes stating the reason and what else they could use instead (if exists). Thanks! https://github.com/llvm/llvm-project/pull/103059 ___ cfe-commits mail

[clang] [analyzer] Model overflow builtins (PR #102602)

2024-08-13 Thread Balazs Benics via cfe-commits
steakhal wrote: Try using the Github merge workflow to avoid doing force-pushes. Those are destructive for inline comments done for the PR. On force-push, GH can't follow to which line it should migrate the existing inline comments, thus drops them. You should just do a fetch main, merge main,

[clang] [llvm] [analyzer] Delete `alpha.security.MallocOverflow` (PR #103059)

2024-08-14 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -1039,10 +1039,6 @@ def ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">, HelpText<"Warn about buffer overflows (newer checker)">, Documentation; -def MallocOverflowSecurityChecker : Checker<"MallocOverflow">,

[clang] [analyzer] Do not reason about locations passed as inline asm input (PR #103714)

2024-08-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Looks good overall. Please compactify the tests by removing newlines that are not strictly necessary. It's a pitty that `ProgramState::invalidateRegions` accepts an `Expr` instead of a `Stmt` and then later inside it just conjures the result of the inval

[clang] [analyzer] Do not reason about locations passed as inline asm input (PR #103714)

2024-08-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/103714 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Do not reason about locations passed as inline asm input (PR #103714)

2024-08-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/103714 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Fix spelling of "definitely". (PR #104455)

2024-08-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/104455 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Fix spelling of "definitely". (PR #104455)

2024-08-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/104455 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Model overflow builtins (PR #102602)

2024-08-16 Thread Balazs Benics via cfe-commits
steakhal wrote: I'm on vacation for some time now. Maybe others can chim in. Should I ping someone? https://github.com/llvm/llvm-project/pull/102602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [analyzer] Set and display CSA analysis entry points as notes on debugging (PR #84823)

2024-04-05 Thread Balazs Benics via cfe-commits
@@ -788,7 +791,7 @@ class PathDiagnostic : public llvm::FoldingSetNode { PathDiagnostic(StringRef CheckerName, const Decl *DeclWithIssue, StringRef bugtype, StringRef verboseDesc, StringRef shortDesc, StringRef category, PathDiagnosticLocatio

[clang] [clang][analyzer] Support `PointerType` in `getCXXRecordDecl` for `ContainerModeling` (PR #87787)

2024-04-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Looks clean to me, even though I haven't checked how the ContainerModeling checker works. https://github.com/llvm/llvm-project/pull/87787 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [llvm] [NFC] Fix misspellings of effects (PR #87795)

2024-04-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/87795 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Support `PointerType` in `getCXXRecordDecl` for `ContainerModeling` (PR #87787)

2024-04-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/87787 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Support `PointerType` in `getCXXRecordDecl` for `ContainerModeling` (PR #87787)

2024-04-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/87787 ___ 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-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 00:00:

[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 https://lists.l

[clang] [libc] [llvm] Fix typos (PR #88565)

2024-04-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/88565 ___ 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-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 m

[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

2024-04-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

2024-04-13 Thread Balazs Benics via cfe-commits
@@ -2836,6 +2836,10 @@ bool RangeConstraintManager::canReasonAbout(SVal X) const { return false; } + // Non-integer types are not supported. + if (X.getAs()) +return false; + steakhal wrote: My problem with this is that I think LCVs shouldn't eve

[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

2024-04-13 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=alpha.cplusplus.InvalidatedIterator \ +// RUN: -analyzer-config aggressive-binary-operation-simplification=true \ +// RUN: 2>&1 + +struct node {}; +struct prop : node {}; +struct bitvec : node { +

[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

2024-04-13 Thread Balazs Benics via cfe-commits
@@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State, // We cannot reason about SymSymExprs, and can only reason about some // SymIntExprs. if (!canReasonAbout(Cond)) { -// Just add the constraint to the expression without tryi

[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

2024-04-13 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 %s \ steakhal wrote: I think you should put this test without the RUN lines into the `clang/test/Analysis/invalidated-iterator.cpp` to have them at one place. https://github.com/llvm/llvm-project/pull/87521 _

[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

2024-04-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Handle builtin functions in MallocChecker (PR #88416)

2024-04-14 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/88416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Handle builtin functions in MallocChecker (PR #88416)

2024-04-14 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. High quality code with descent description. Really nice work. Nothing really stood out to me that I'd object. https://github.com/llvm/llvm-project/pull/88416 __

[clang] [analyzer] Handle builtin functions in MallocChecker (PR #88416)

2024-04-14 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -214,3 +214,15 @@ void *realloc(void **ptr, size_t size) { realloc(ptr, size); } // no-crash namespace pr46253_paramty2{ void *realloc(void *ptr, int size) { realloc(ptr, size); } // no-crash } // namespace pr46253_paramty2

[clang] [analyzer] New optin.taint.TaintedAlloc checker for catching unbounded memory allocation calls (PR #92420)

2024-06-05 Thread Balazs Benics via cfe-commits
@@ -938,6 +938,53 @@ optin.portability.UnixAPI " Finds implementation-defined behavior in UNIX/Posix functions. +.. _optin-taint-TaintedAlloc: + +optin.taint.TaintedAlloc (C, C++) +""" steakhal wrote: ```sug

[clang] [analyzer] Factor out NoOwnershipChangeVisitor (PR #94357)

2024-06-05 Thread Balazs Benics via cfe-commits
steakhal wrote: Is this NFC? https://github.com/llvm/llvm-project/pull/94357 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] New optin.taint.TaintedAlloc checker for catching unbounded memory allocation calls (PR #92420)

2024-06-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/92420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -907,6 +945,73 @@ void StreamChecker::preWrite(const FnDescription *Desc, const CallEvent &Call, C.addTransition(State); } +static std::optional getPointeeType(const MemRegion *R) { + if (!R) +return std::nullopt; + if (const auto *ER = dyn_cast(R)) +return ER-

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/93408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
@@ -907,6 +945,73 @@ void StreamChecker::preWrite(const FnDescription *Desc, const CallEvent &Call, C.addTransition(State); } +static std::optional getPointeeType(const MemRegion *R) { + if (!R) +return std::nullopt; + if (const auto *ER = dyn_cast(R)) +return ER-

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/93408 Unicorn! · GitHub body { background-color: #f1f1f1; margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .container { margin: 50px au

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balazs Benics via cfe-commits
steakhal wrote: Addressed all the feedback. https://github.com/llvm/llvm-project/pull/93408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Improved PointerSubChecker (PR #93676)

2024-06-07 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: @@ -53,10 +62,10 @@ void f4(void) { int (*p)[m] = a; // p == &a[0] p += 1; // p == &a[1] - // FIXME: This warning is not needed + // FIXM

[clang] [clang][analyzer] Improved PointerSubChecker (PR #93676)

2024-06-07 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. LGTM, thanks. Minor nits. https://github.com/llvm/llvm-project/pull/93676

[clang] [clang][analyzer] Improved PointerSubChecker (PR #93676)

2024-06-07 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/93676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] [llvm] Add SonarCloud (PR #94745)

2024-06-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/94745 >From 099e93f425293daf376eccbe6fd771f297126588 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Fri, 7 Jun 2024 12:55:07 +0200 Subject: [PATCH 1/2] Add initial SonarCloud config --- .github/workflows/clang-t

[clang] [llvm] Add SonarCloud (PR #94745)

2024-06-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/94745 >From 099e93f425293daf376eccbe6fd771f297126588 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Fri, 7 Jun 2024 12:55:07 +0200 Subject: [PATCH 1/3] Add initial SonarCloud config --- .github/workflows/clang-t

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/93408 >From f9e841ddaa865d529c806b2d115d5ddbc7109243 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 26 May 2024 11:40:01 +0200 Subject: [PATCH 01/16] [analyzer] Refine invalidation caused by `fread` This cha

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/93408 >From f9e841ddaa865d529c806b2d115d5ddbc7109243 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 26 May 2024 11:40:01 +0200 Subject: [PATCH 01/16] [analyzer] Refine invalidation caused by `fread` This cha

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balazs Benics via cfe-commits
steakhal wrote: Let's do another round. https://github.com/llvm/llvm-project/pull/93408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Replace X && isa(X) with isa_and_nonnull(X). NFC (PR #94987)

2024-06-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: LGTM, thanks! https://github.com/llvm/llvm-project/pull/94987 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Move 'alpha.cplusplus.MisusedMovedObject' to 'cplusplus.Move' in documentation (NFC) (PR #95003)

2024-06-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/95003 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add SonarCloud (PR #94745)

2024-06-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/94745 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [analyzer][NFC] Reorganize Z3 report refutation (PR #95128)

2024-06-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/95128 This change keeps existing behavior, namely that if we hit a Z3 timeout we will accept the report as "satisfiable". This prepares for the commit "Harden safeguards for Z3 query times". https://discourse.llvm.org

[clang] [analyzer] Finish moving alpha.core.SizeofPtr to clang-tidy (PR #95118)

2024-06-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. We should remember to mention this transfer explicitly in the release notes one day. But given that we don't really maintain/sync the release notes that's for another day, closer to the release branchoff. https://github.com/llvm/llvm-proj

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/94957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Krist=C3=B3f?= Umann , =?utf-8?q?Krist=C3=B3f?= Umann , =?utf-8?q?Krist=C3=B3f?= Umann Message-ID: In-Reply-To: https://github.com/steakhal commented: LGTM. I only had some nits and some terminology flexing. https://github.com/llvm/llvm-project/pull/94957 ___

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: @@ -696,6 +730,69 @@ struct StreamOperationEvaluator { } // end anonymous namespace +//===--===//

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: @@ -696,6 +730,69 @@ struct StreamOperationEvaluator { } // end anonymous namespace +//===--===//

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: @@ -300,6 +333,8 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/94957 ___ cfe-commits mailing

<    5   6   7   8   9   10   11   12   13   14   >