brintos

brintos / llvm-project-archived public Read only

0
0
Text · 616 B · d564ef8 Raw
21 lines · c
1// Test stopset overflow in strspn function2// RUN: %clang_asan %s -o %t && %env_asan_opts=strict_string_checks=true not %run %t 2>&1 | FileCheck %s3 4// Test intercept_strspn asan option5// RUN: %env_asan_opts=intercept_strspn=false %run %t 2>&16 7#include <assert.h>8#include <string.h>9#include <sanitizer/asan_interface.h>10 11int main(int argc, char **argv) {12  size_t r;13  char s1[] = "bbc";14  char s2[5] = "abcd";15  __asan_poison_memory_region ((char *)&s2[3], 2);16  r = strspn(s1, s2);17  // CHECK:'s2'{{.*}} <== Memory access at offset {{[0-9]+}} partially overflows this variable18  assert(r >= 2);19  return 0;20}21