aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/ProgramTest.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-03-05 12:45:13 +0100
committerGitHub <noreply@github.com>2025-03-05 12:45:13 +0100
commit53c157939e5ac9acc8e1f8853325a021bc925501 (patch)
tree8f7c8bd3402148989dd12b05f696bfe6b0dcff23 /llvm/unittests/Support/ProgramTest.cpp
parentba1da5cd43055f0d75c36b02e60ac57e3651aa33 (diff)
downloadllvm-53c157939e5ac9acc8e1f8853325a021bc925501.zip
llvm-53c157939e5ac9acc8e1f8853325a021bc925501.tar.gz
llvm-53c157939e5ac9acc8e1f8853325a021bc925501.tar.bz2
[StackProtector] Fix phi handling in HasAddressTaken() (#129248)
Despite the name, the HasAddressTaken() heuristic identifies not only allocas that have their address taken, but also those that have accesses that cannot be proven to be in-bounds. However, the current handling for phi nodes is incorrect. Phi nodes are only visited once, and will perform the analysis using whichever (remaining) allocation size is passed the first time the phi node is visited. If it is later visited with a smaller remaining size, which may lead to out of bounds accesses, it will not be detected. Fix this by keeping track of the smallest seen remaining allocation size and redo the analysis if it is decreased. To avoid degenerate cases (including via loops), limit the number of allowed decreases to a small number.
Diffstat (limited to 'llvm/unittests/Support/ProgramTest.cpp')
0 files changed, 0 insertions, 0 deletions