<commit_before>// REQUIRES: asan-64-bits
// RUN: %clangxx_asan -O3 %s -o %t
// RUN:                                    not %run %t 2>&1  | FileCheck %s
// RUN: ASAN_OPTIONS=poison_array_cookie=1 not %run %t 2>&1  | FileCheck %s
// RUN: ASAN_OPTIONS=poison_array_cookie=0     %run %t
#include <stdio.h>
struct C {
  int x;
  ~C() {fprintf(stderr, "ZZZZZZZZ\n");}
};

int main(int argc, char **argv) {
  C *buffer = new C[argc];
  buffer[-2].x = 10;
// CHECK: AddressSanitizer: heap-buffer-overflow
// CHECK: in main {{.*}}new_array_cookie_test.cc:[[@LINE-2]]
// CHECK: is located 0 bytes inside of 12-byte region
  delete [] buffer;
}<commit_msg>[asan] make new_array_cookie_test more robust<commit_after>// REQUIRES: asan-64-bits
// RUN: %clangxx_asan -O3 %s -o %t
// RUN:                                    not %run %t 2>&1  | FileCheck %s
// RUN: ASAN_OPTIONS=poison_array_cookie=1 not %run %t 2>&1  | FileCheck %s
// RUN: ASAN_OPTIONS=poison_array_cookie=0 not %run %t 2>&1  | FileCheck %s --check-prefix=NO_COOKIE
#include <stdio.h>
#include <stdlib.h>
struct C {
  int x;
  ~C() {
    fprintf(stderr, "ZZZZZZZZ\n");
    exit(1);
  }
};

int main(int argc, char **argv) {
  C *buffer = new C[argc];
  buffer[-2].x = 10;
// CHECK: AddressSanitizer: heap-buffer-overflow
// CHECK: in main {{.*}}new_array_cookie_test.cc:[[@LINE-2]]
// CHECK: is located 0 bytes inside of 12-byte region
// NO_COOKIE: ZZZZZZZZ
  delete [] buffer;
}
{'fraction_non_alphanumeric': 0.16899441340782123, 'fraction_numerical': 0.024441340782122904, 'mean_word_length': 3.0027932960893855, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '929568', 'n_tokens_mistral': 590, 'n_tokens_neox': 556, 'n_words': 146}