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