23 lines · cpp
1// Make sure symbolization works even if the path to the .exe file changes.2// RUN: mkdir %t || true3// RUN: %clang_cl_asan %Od %s %Fe%t/symbols_path.exe4// RUN: not %run %t/symbols_path.exe 2>&1 | FileCheck %s5// RUN: mkdir %t2 || true6// RUN: mv %t/* %t27// RUN: not %run %t2/symbols_path.exe 2>&1 | FileCheck %s8 9#include <malloc.h>10 11int main() {12 char *buffer = (char*)malloc(42);13 buffer[-1] = 42;14 // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]15 // CHECK: WRITE of size 1 at [[ADDR]] thread T016 // CHECK-NEXT: {{#0 .* main .*symbols_path.cpp}}:[[@LINE-3]]17 // CHECK: [[ADDR]] is located 1 bytes before 42-byte region18 // CHECK: allocated by thread T0 here:19 // CHECK-NEXT: {{#0 .* malloc}}20 // CHECK: {{ #[1-3] .* main .*symbols_path.cpp}}:[[@LINE-8]]21 free(buffer);22}23