File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ int vprintf (const char *restrict format, va_list arg);
23
23
24
24
int vsprintf (char * restrict s , const char * restrict format , va_list arg );
25
25
26
+ int vfprintf (FILE * stream , const char * format , va_list ap );
27
+
26
28
int vfscanf (FILE * stream , const char * format , va_list ap );
27
29
28
30
int some_library_function (int n , va_list arg );
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream,debug.ExprInspection -verify %s
2
2
3
3
#include "Inputs/system-header-simulator.h"
4
+ #include "Inputs/system-header-simulator-for-valist.h"
4
5
5
6
void clang_analyzer_eval (int );
6
7
@@ -141,6 +142,18 @@ void f_dopen(int fd) {
141
142
fclose (F );
142
143
}
143
144
145
+ void f_vfprintf (int fd , va_list args ) {
146
+ FILE * F = fdopen (fd , "r" );
147
+ vfprintf (F , "%d" , args ); // expected-warning {{Stream pointer might be NULL}}
148
+ fclose (F );
149
+ }
150
+
151
+ void f_vfscanf (int fd , va_list args ) {
152
+ FILE * F = fdopen (fd , "r" );
153
+ vfscanf (F , "%u" , args ); // expected-warning {{Stream pointer might be NULL}}
154
+ fclose (F );
155
+ }
156
+
144
157
void f_seek (void ) {
145
158
FILE * p = fopen ("foo" , "r" );
146
159
if (!p )
You can’t perform that action at this time.
0 commit comments