1 // Test that the common part implementation of *printf interceptors does not
2 // cause negative-size-param false positives.
4 // RUN: %clangxx -O2 %s -o %t
5 // RUN: %env_tool_opts=check_printf=1 %run %t 2>&1
7 // FIXME: The maximum supported allocation size is too platform-specific:
8 // REQUIRES: x86_64-target-arch
10 // FIXME: printf is not intercepted on Windows yet.
11 // UNSUPPORTED: target={{.*windows-msvc.*}}
18 void write(char *buf
, int buf_size
, const char *fmt
, ...) {
21 vsnprintf(buf
, buf_size
, fmt
, args
);
27 const size_t kStrSize
= 1UL << 31;
28 char *x
= (char *)malloc(kStrSize
);
29 memset(x
, '=', kStrSize
- 1);
31 write(buffer
, 100, "%s\n", x
);