16 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s2 3// REQUIRES: !android4 5#include <assert.h>6#include <strings.h>7 8int main(int argc, char *argv[]) {9 char buf[100];10 // *& to suppress bzero-to-memset optimization.11 (*&bzero)(buf, sizeof(buf) + 1);12 // CHECK: AddressSanitizer: stack-buffer-overflow13 // CHECK-NEXT: WRITE of size 101 at14 return 0;15}16