1 // REQUIRES: gwp_asan 2 // RUN: %clangxx_gwp_asan %s -o %t 3 // RUN: %expect_crash %run %t 2>&1 | FileCheck %s 4 5 // CHECK: GWP-ASan detected a memory error 6 // CHECK: Buffer overflow occurred when accessing memory at: 7 // CHECK: is located {{[0-9]+}} bytes to the right 8 9 #include <cstdlib> 10 11 #include "page_size.h" 12 13 int main() { 14 char *Ptr = 15 reinterpret_cast<char *>(malloc(pageSize())); 16 volatile char x = *(Ptr + pageSize()); 17 return 0; 18 } 19