]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/Darwin/uuid.cc
New upstream version 1.19.0+dfsg1
[rustc.git] / src / compiler-rt / test / asan / TestCases / Darwin / uuid.cc
1 // RUN: %clangxx_asan %s -o %t
2 // RUN: %env_asan_opts=print_module_map=1 not %run %t 2>&1 | FileCheck %s
3 // RUN: %env_asan_opts=print_module_map=2 not %run %t 2>&1 | FileCheck %s
4 // RUN: %clangxx_asan %s -o %t -fsanitize-recover=address
5 // RUN: %env_asan_opts=print_module_map=2:halt_on_error=0 %run %t 2>&1 | FileCheck %s
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10
11 int main(int argc, char *argv[]) {
12 char buf[2048];
13 snprintf(buf, sizeof(buf), "otool -l %s 1>&2", argv[0]);
14 system(buf);
15 // CHECK: cmd LC_UUID
16 // CHECK-NEXT: cmdsize 24
17 // CHECK-NEXT: uuid [[UUID:[0-9A-F-]{36}]]
18
19 char *x = (char*)malloc(10 * sizeof(char));
20 free(x);
21 char mybuf[10];
22 memcpy(mybuf, x, 10);
23 // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}
24 // CHECK: Process module map:
25 // CHECK: uuid.cc.tmp {{.*}} <[[UUID]]>
26
27 fprintf(stderr, "Done.\n");
28 }