view compiler-rt/test/msan/scanf-allocate.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 79ff65ed7e25
children
line wrap: on
line source

// RUN: %clangxx_msan -O0 %s -o %t && %run %t >%t.out 2>&1
// FileCheck %s <%t.out

#include <sanitizer/msan_interface.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv) {
  char *str;
  sscanf("#string#", "%ms", &str);
  printf("str = %s\n", str);
  __msan_check_mem_is_initialized(str, strlen(str) + 1);
  // CHECK: #string#
}