forked from wangliu-iscas/gcc-patch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asan: fix unsafe optimization of Asan checks.
gcc/ PR sanitizer/106558 * sanopt.c: Do not optimize out checks for non-SSA addresses. gcc/testsuite/ PR sanitizer/106558 * c-c++-common/asan/pr106558.c: New test.
- Loading branch information
1 parent
ec8ec09
commit 4040cca
Showing
2 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* { dg-do run } */ | ||
/* { dg-options "-w -fpermissive" } */ | ||
/* { dg-shouldfail "asan" } */ | ||
|
||
int a; | ||
int *b = &a; | ||
int **c = &b; | ||
int d[1]; | ||
int *e = &d[1]; | ||
|
||
static int f(int *g) { | ||
*b = e; | ||
*c = e; | ||
*b = 2; | ||
*g = 2; | ||
} | ||
|
||
int main() { | ||
f(b); | ||
return *b; | ||
} | ||
|
||
/* { dg-output "AddressSanitizer: global-buffer-overflow on address" } */ |