2 /* { dg-options "-fno-builtin-malloc -fno-builtin-free -fno-builtin-memset" } */
3 /* { dg-shouldfail "asan" } */
9 void *memset (void *, int, __SIZE_TYPE__
);
10 void *malloc (__SIZE_TYPE__
);
17 volatile int ten
= 10;
18 int main(int argc
, char **argv
) {
19 char *x
= (char*)malloc(10);
21 int res
= x
[ten
]; /* BOOOM */
26 /* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
27 /* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:21|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
28 /* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes to the right of 10-byte region\[^\n\r]*(\n|\r\n|\r)" } */
29 /* { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
30 /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
31 /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:19|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */