1 | // ASan-poisoned memory should be ignored if use_poisoned is false. |
2 | // REQUIRES: asan |
3 | // RUN: %clangxx_lsan %s -o %t |
4 | // RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_poisoned=0" not %run %t 2>&1 | FileCheck %s |
5 | // RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_poisoned=1" %run %t 2>&1 |
6 | |
7 | #include <stdio.h> |
8 | #include <stdlib.h> |
9 | #include <sanitizer/asan_interface.h> |
10 | #include <assert.h> |
11 | #include "sanitizer_common/print_address.h" |
12 | |
13 | void **p; |
14 | |
15 | int main() { |
16 | p = new void *; |
17 | *p = malloc(size: 1337); |
18 | print_address("Test alloc: " , 1, *p); |
19 | __asan_poison_memory_region(addr: p, size: sizeof(*p)); |
20 | return 0; |
21 | } |
22 | // CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] |
23 | // CHECK: LeakSanitizer: detected memory leaks |
24 | // CHECK: [[ADDR]] (1337 bytes) |
25 | // CHECK: SUMMARY: AddressSanitizer: |
26 | |