[LifetimeSafety] Track assignment chains within the same statement
https://godbolt.org/z/zE1raqKzY
void target() {
int *s;
{
int tgt = 2;
int *a, *b, *c;
a = b = c = &tgt;
s = a;
}
printf("s: %d\n", *s);
}
There is a use-after-free bug in the code above, but the current implementation fails to detect it.
This happens because a and b do not hold the corresponding Loan for tgt. As a result, if we replace s = a with s = c, the use-after-free can be correctly identified.
I have conducted a preliminary analysis of this issue, which can be found here: https://github.com/llvm/llvm-project/pull/196075#discussion_r3264392605
@llvm/issue-subscribers-clang-temporal-safety
Author: Yuan Suo (suoyuan666)
void target() {
int *s;
{
int tgt = 2;
int *a, *b, *c;
a = b = c = &tgt;
s = a;
}
printf("s: %d\n", *s);
}
There is a use-after-free bug in the code above, but the current implementation fails to detect it.
This happens because a and b do not hold the corresponding Loan for tgt. As a result, if we replace s = a with s = c, the use-after-free can be correctly identified.
I have conducted a preliminary analysis of this issue, which can be found here: https://github.com/llvm/llvm-project/pull/196075#discussion_r3264392605
I would like to work on this.