Home | History | Annotate | Download | only in Analysis
      1 // RUN: %clang_cc1  -analyze -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify
      2 // expected-no-diagnostics
      3 
      4 typedef struct _FILE FILE;
      5 typedef __typeof(sizeof(int)) size_t;
      6 extern FILE *stdin;
      7 typedef long ssize_t;
      8 ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
      9 int  printf(const char * __restrict, ...);
     10 void free(void *ptr);
     11 
     12 struct GetLineTestStruct {
     13   ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
     14 };
     15 
     16 void getlineTest(void) {
     17   FILE *fp;
     18   char *line = 0;
     19   size_t len = 0;
     20   ssize_t read;
     21   struct GetLineTestStruct T;
     22 
     23   while ((read = T.getline(&line, &len, stdin)) != -1) {
     24     printf("%s", line); // no warning
     25   }
     26   free(line);
     27 }
     28