brintos

brintos / llvm-project-archived public Read only

0
0
Text · 800 B · 2cc05b5 Raw
26 lines · cpp
1// ASan-poisoned memory should be ignored if use_poisoned is false.2// REQUIRES: asan3// RUN: %clangxx_lsan %s -o %t4// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_poisoned=0" not %run %t 2>&1 | FileCheck %s5// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_poisoned=1" %run %t 2>&16 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 13void **p;14 15int main() {16  p = new void *;17  *p = malloc(1337);18  print_address("Test alloc: ", 1, *p);19  __asan_poison_memory_region(p, sizeof(*p));20  return 0;21}22// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]23// CHECK: LeakSanitizer: detected memory leaks24// CHECK: [[ADDR]] (1337 bytes)25// CHECK: SUMMARY: AddressSanitizer:26