Anna Zaks | b9ac30c | 2012-01-24 19:32:25 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.taint,debug.TaintTest %s -verify |
| 2 | |
| 3 | typedef struct _FILE FILE; |
| 4 | typedef __typeof(sizeof(int)) size_t; |
| 5 | extern FILE *stdin; |
| 6 | typedef long ssize_t; |
| 7 | ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); |
| 8 | int printf(const char * __restrict, ...); |
| 9 | void free(void *ptr); |
| 10 | |
| 11 | struct GetLineTestStruct { |
| 12 | ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); |
| 13 | }; |
| 14 | |
| 15 | void getlineTest(void) { |
| 16 | FILE *fp; |
| 17 | char *line = 0; |
| 18 | size_t len = 0; |
| 19 | ssize_t read; |
| 20 | struct GetLineTestStruct T; |
| 21 | |
| 22 | while ((read = T.getline(&line, &len, stdin)) != -1) { |
| 23 | printf("%s", line); // no warning |
| 24 | } |
| 25 | free(line); |
| 26 | } |