[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread via cfe-commits

github-actions[bot] wrote:



@LoboQ1ng Congratulations on having your first Pull Request (PR) merged into 
the LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a 
problem with a build, you may receive a report in an email or a comment on this 
PR.

Please check whether problems have been caused by your change specifically, as 
the builds can include changes from many authors. It is not uncommon for your 
change to be included in a build that fails due to someone else's changes, or 
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself. This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits


@@ -0,0 +1,44 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -verify %s
+
+#include "Inputs/system-header-simulator-for-malloc.h"
+
+struct Obj {
+  int field;
+};
+
+void use(void *ptr);
+
+void test_direct_param_uaf() {
+  int *p = (int *)malloc(sizeof(int));
+  free(p);
+  use(p); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_struct_field_uaf() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  free(o);
+  use(&o->field); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_no_warning_const_int() {
+  use((void *)0x1234); // no-warning
+}
+
+void test_no_warning_stack() {
+  int x = 42;
+  use(&x); // no-warning
+}
+
+void test_nested_alloc() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  use(o);   // no-warning
+  free(o);
+  use(o);   // expected-warning{{Use of memory after it is freed}}

steakhal wrote:

```suggestion
  use(o);   // expected-warning{{Use of memory after it is released}}
```

https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-x86_64-debian` 
running on `lldb-x86_64-debian` while building `clang` at step 6 "test".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/162/builds/28573


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/expression/call-function/TestCallStopAndContinue.py 
(279 of 3137)
PASS: lldb-api :: functionalities/lazy-loading/TestLazyLoading.py (280 of 3137)
PASS: lldb-api :: 
functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py (281 of 
3137)
PASS: lldb-api :: 
functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py
 (282 of 3137)
PASS: lldb-shell :: SymbolFile/DWARF/debug-types-expressions.test (283 of 3137)
PASS: lldb-api :: 
functionalities/thread/exit_during_expression/TestExitDuringExpression.py (284 
of 3137)
PASS: lldb-api :: tools/lldb-dap/exception/TestDAP_exception.py (285 of 3137)
PASS: lldb-api :: 
functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py (286 
of 3137)
PASS: lldb-api :: tools/lldb-dap/locations/TestDAP_locations.py (287 of 3137)
XFAIL: lldb-api :: functionalities/longjmp/TestLongjmp.py (288 of 3137)
FAIL: lldb-api :: tools/lldb-dap/output/TestDAP_output.py (289 of 3137)
 TEST 'lldb-api :: tools/lldb-dap/output/TestDAP_output.py' 
FAILED 
Script:
--
/usr/bin/python3 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u 
CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env 
LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env 
LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 
--build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make 
/usr/bin/gmake --llvm-tools-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root 
/home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --cmake-build-type Release -t 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/tools/lldb-dap/output
 -p TestDAP_output.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 
5bb7ba6222f7bdee30835c40f2c2bc9c98157c70)
  clang revision 5bb7ba6222f7bdee30835c40f2c2bc9c98157c70
  llvm revision 5bb7ba6222f7bdee30835c40f2c2bc9c98157c70
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 
'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
Change dir to: 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/tools/lldb-dap/output
runCmd: settings clear --all

output: 

runCmd: settings set symbols.enable-external-lookup false

output: 

runCmd: settings set target.inherit-tcc true

output: 

runCmd: settings set target.disable-aslr false

output: 

runCmd: settings set target.detach-on-error false

output: 


```



https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal closed 
https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal updated 
https://github.com/llvm/llvm-project/pull/152462

>From 909f0bce1aec9939eeecdaa8c3f0a028f89d96f4 Mon Sep 17 00:00:00 2001
From: LoboQ1ng 
Date: Thu, 7 Aug 2025 16:52:39 +0800
Subject: [PATCH 1/5] [StaticAnalyzer] [MallocChecker] Detect use-after-free
 for field address (e.g., &ptr->field)

---
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 369d6194dbb65..ad1d20779f384 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -3156,8 +3156,14 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
   for (unsigned I = 0, E = Call.getNumArgs(); I != E; ++I) {
 SVal ArgSVal = Call.getArgSVal(I);
 if (isa(ArgSVal)) {
-  SymbolRef Sym = ArgSVal.getAsSymbol();
-  if (!Sym)
+  const MemRegion *MR = ArgSVal.getAsRegion();
+  if (!MR)
+continue;
+  const MemRegion *BaseRegion = MR->getBaseRegion();
+  SymbolRef Sym = nullptr;
+  if (const auto *SR = dyn_cast(BaseRegion))
+Sym = SR->getSymbol();
+  if (!Sym) 
 continue;
   if (checkUseAfterFree(Sym, C, Call.getArgExpr(I)))
 return;

>From a19a454b4940b0bc12c765a358eb09088f9f9e46 Mon Sep 17 00:00:00 2001
From: LoboQ1ng 
Date: Thu, 7 Aug 2025 19:19:15 +0800
Subject: [PATCH 2/5] add test case

---
 clang/test/Analysis/malloc-checker-arg-uaf.c | 44 
 1 file changed, 44 insertions(+)
 create mode 100644 clang/test/Analysis/malloc-checker-arg-uaf.c

diff --git a/clang/test/Analysis/malloc-checker-arg-uaf.c 
b/clang/test/Analysis/malloc-checker-arg-uaf.c
new file mode 100644
index 0..54cfe6633910c
--- /dev/null
+++ b/clang/test/Analysis/malloc-checker-arg-uaf.c
@@ -0,0 +1,44 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=unix.Malloc -verify %s
+
+#include "Inputs/system-header-simulator-for-malloc.h"
+
+struct Obj {
+  int field;
+};
+
+void use(void *ptr);
+
+void test_direct_param_uaf() {
+  int *p = (int *)malloc(sizeof(int));
+  free(p);
+  use(p); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_struct_field_uaf() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  free(o);
+  use(&o->field); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_no_warning_const_int() {
+  use((void *)0x1234); // no-warning
+}
+
+void test_no_warning_stack() {
+  int x = 42;
+  use(&x); // no-warning
+}
+
+void test_nested_alloc() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  use(o);   // no-warning
+  free(o);
+  use(o);   // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_nested_field() {
+struct Obj *o = malloc(sizeof(struct Obj));
+int *f = &o->field;
+free(o);
+use(f); // expected-warning{{Use of memory after it is freed}}
+}
\ No newline at end of file

>From dbcf8b4d84a9fad6a2b865cf20751339ff96c2c7 Mon Sep 17 00:00:00 2001
From: LoboQ1ng 
Date: Fri, 8 Aug 2025 10:14:58 +0800
Subject: [PATCH 3/5] Update
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Donát Nagy 
---
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index ad1d20779f384..fb7e80f06385d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -3156,13 +3156,7 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
   for (unsigned I = 0, E = Call.getNumArgs(); I != E; ++I) {
 SVal ArgSVal = Call.getArgSVal(I);
 if (isa(ArgSVal)) {
-  const MemRegion *MR = ArgSVal.getAsRegion();
-  if (!MR)
-continue;
-  const MemRegion *BaseRegion = MR->getBaseRegion();
-  SymbolRef Sym = nullptr;
-  if (const auto *SR = dyn_cast(BaseRegion))
-Sym = SR->getSymbol();
+  SymbolRef Sym = ArgSVal.getAsSymbol(/*IncludeBaseRegions=*/true);
   if (!Sym) 
 continue;
   if (checkUseAfterFree(Sym, C, Call.getArgExpr(I)))

>From 11715c0a6e8cb982320a9d102fda24ae0553e571 Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Fri, 8 Aug 2025 19:21:33 +0200
Subject: [PATCH 4/5] Apply suggestions from code review

---
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 2 +-
 clang/test/Analysis/malloc-checker-arg-uaf.c| 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index fb7e80f06385d..efb980962e811 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b

[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits


@@ -0,0 +1,44 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -verify %s
+
+#include "Inputs/system-header-simulator-for-malloc.h"
+
+struct Obj {
+  int field;
+};
+
+void use(void *ptr);
+
+void test_direct_param_uaf() {
+  int *p = (int *)malloc(sizeof(int));
+  free(p);
+  use(p); // expected-warning{{Use of memory after it is freed}}

steakhal wrote:

```suggestion
  use(p); // expected-warning{{Use of memory after it is released}}
```

https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits


@@ -0,0 +1,44 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -verify %s
+
+#include "Inputs/system-header-simulator-for-malloc.h"
+
+struct Obj {
+  int field;
+};
+
+void use(void *ptr);
+
+void test_direct_param_uaf() {
+  int *p = (int *)malloc(sizeof(int));
+  free(p);
+  use(p); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_struct_field_uaf() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  free(o);
+  use(&o->field); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_no_warning_const_int() {
+  use((void *)0x1234); // no-warning
+}
+
+void test_no_warning_stack() {
+  int x = 42;
+  use(&x); // no-warning
+}
+
+void test_nested_alloc() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  use(o);   // no-warning
+  free(o);
+  use(o);   // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_nested_field() {
+struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+int *f = &o->field;
+free(o);
+use(f); // expected-warning{{Use of memory after it is freed}}

steakhal wrote:

```suggestion
use(f); // expected-warning{{Use of memory after it is released}}
```

https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits


@@ -0,0 +1,44 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -verify %s
+
+#include "Inputs/system-header-simulator-for-malloc.h"
+
+struct Obj {
+  int field;
+};
+
+void use(void *ptr);
+
+void test_direct_param_uaf() {
+  int *p = (int *)malloc(sizeof(int));
+  free(p);
+  use(p); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_struct_field_uaf() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  free(o);
+  use(&o->field); // expected-warning{{Use of memory after it is freed}}

steakhal wrote:

```suggestion
  use(&o->field); // expected-warning{{Use of memory after it is released}}
```

https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal updated 
https://github.com/llvm/llvm-project/pull/152462

>From 909f0bce1aec9939eeecdaa8c3f0a028f89d96f4 Mon Sep 17 00:00:00 2001
From: LoboQ1ng 
Date: Thu, 7 Aug 2025 16:52:39 +0800
Subject: [PATCH 1/4] [StaticAnalyzer] [MallocChecker] Detect use-after-free
 for field address (e.g., &ptr->field)

---
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 369d6194dbb65..ad1d20779f384 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -3156,8 +3156,14 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
   for (unsigned I = 0, E = Call.getNumArgs(); I != E; ++I) {
 SVal ArgSVal = Call.getArgSVal(I);
 if (isa(ArgSVal)) {
-  SymbolRef Sym = ArgSVal.getAsSymbol();
-  if (!Sym)
+  const MemRegion *MR = ArgSVal.getAsRegion();
+  if (!MR)
+continue;
+  const MemRegion *BaseRegion = MR->getBaseRegion();
+  SymbolRef Sym = nullptr;
+  if (const auto *SR = dyn_cast(BaseRegion))
+Sym = SR->getSymbol();
+  if (!Sym) 
 continue;
   if (checkUseAfterFree(Sym, C, Call.getArgExpr(I)))
 return;

>From a19a454b4940b0bc12c765a358eb09088f9f9e46 Mon Sep 17 00:00:00 2001
From: LoboQ1ng 
Date: Thu, 7 Aug 2025 19:19:15 +0800
Subject: [PATCH 2/4] add test case

---
 clang/test/Analysis/malloc-checker-arg-uaf.c | 44 
 1 file changed, 44 insertions(+)
 create mode 100644 clang/test/Analysis/malloc-checker-arg-uaf.c

diff --git a/clang/test/Analysis/malloc-checker-arg-uaf.c 
b/clang/test/Analysis/malloc-checker-arg-uaf.c
new file mode 100644
index 0..54cfe6633910c
--- /dev/null
+++ b/clang/test/Analysis/malloc-checker-arg-uaf.c
@@ -0,0 +1,44 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=unix.Malloc -verify %s
+
+#include "Inputs/system-header-simulator-for-malloc.h"
+
+struct Obj {
+  int field;
+};
+
+void use(void *ptr);
+
+void test_direct_param_uaf() {
+  int *p = (int *)malloc(sizeof(int));
+  free(p);
+  use(p); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_struct_field_uaf() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  free(o);
+  use(&o->field); // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_no_warning_const_int() {
+  use((void *)0x1234); // no-warning
+}
+
+void test_no_warning_stack() {
+  int x = 42;
+  use(&x); // no-warning
+}
+
+void test_nested_alloc() {
+  struct Obj *o = (struct Obj *)malloc(sizeof(struct Obj));
+  use(o);   // no-warning
+  free(o);
+  use(o);   // expected-warning{{Use of memory after it is freed}}
+}
+
+void test_nested_field() {
+struct Obj *o = malloc(sizeof(struct Obj));
+int *f = &o->field;
+free(o);
+use(f); // expected-warning{{Use of memory after it is freed}}
+}
\ No newline at end of file

>From dbcf8b4d84a9fad6a2b865cf20751339ff96c2c7 Mon Sep 17 00:00:00 2001
From: LoboQ1ng 
Date: Fri, 8 Aug 2025 10:14:58 +0800
Subject: [PATCH 3/4] Update
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Donát Nagy 
---
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index ad1d20779f384..fb7e80f06385d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -3156,13 +3156,7 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
   for (unsigned I = 0, E = Call.getNumArgs(); I != E; ++I) {
 SVal ArgSVal = Call.getArgSVal(I);
 if (isa(ArgSVal)) {
-  const MemRegion *MR = ArgSVal.getAsRegion();
-  if (!MR)
-continue;
-  const MemRegion *BaseRegion = MR->getBaseRegion();
-  SymbolRef Sym = nullptr;
-  if (const auto *SR = dyn_cast(BaseRegion))
-Sym = SR->getSymbol();
+  SymbolRef Sym = ArgSVal.getAsSymbol(/*IncludeBaseRegions=*/true);
   if (!Sym) 
 continue;
   if (checkUseAfterFree(Sym, C, Call.getArgExpr(I)))

>From 11715c0a6e8cb982320a9d102fda24ae0553e571 Mon Sep 17 00:00:00 2001
From: Balazs Benics 
Date: Fri, 8 Aug 2025 19:21:33 +0200
Subject: [PATCH 4/4] Apply suggestions from code review

---
 clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 2 +-
 clang/test/Analysis/malloc-checker-arg-uaf.c| 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index fb7e80f06385d..efb980962e811 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b

[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal edited 
https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal edited 
https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal approved this pull request.

Thank you for your finding. It will be automatically merged once the CI bots 
are happy.

https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

2025-08-08 Thread Balazs Benics via cfe-commits

https://github.com/steakhal edited 
https://github.com/llvm/llvm-project/pull/152462
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits