[all-commits] [llvm/llvm-project] 30b1d1: [analyzer] Fix inf recursion in StackAddrEscapeChe...
Balázs Benics via All-commits
all-commits at lists.llvm.org
Mon Nov 24 01:30:33 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 30b1d1422733c012c274f173a3f4986615f7c1c7
https://github.com/llvm/llvm-project/commit/30b1d1422733c012c274f173a3f4986615f7c1c7
Author: Balázs Benics <benicsbalazs at gmail.com>
Date: 2025-11-24 (Mon, 24 Nov 2025)
Changed paths:
M clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
M clang/test/Analysis/stackaddrleak.c
Log Message:
-----------
[analyzer] Fix inf recursion in StackAddrEscapeChecker for self referencing blocks (#169208)
Objective-C blocks are like lambdas. They have captures, just like lambdas.
However, they can also implicitly capture themselves unlike lambdas.
This means that when walking the captures of a block, we may end up in
infinite recursion. This is not possible with lambdas, but happened in
practice with blocks downstream.
In this patch, I just use a set to keep track of the visited MemRegions.
Note that theoretically, there is nothing preventing usual lambdas or
functors from falling for the same trap, but probably slightly more
difficult to do so. You would likely need a pointer to itself, etc. I'll
not speculate here.
This inf recursion was likely caused by #126620, released in clang-21.
rdar://162215172
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list