summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/taint-generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/taint-generic.c')
-rw-r--r--clang/test/Analysis/taint-generic.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Analysis/taint-generic.c b/clang/test/Analysis/taint-generic.c
index 4d933e7b75c..60a27c5ce46 100644
--- a/clang/test/Analysis/taint-generic.c
+++ b/clang/test/Analysis/taint-generic.c
@@ -56,6 +56,8 @@ extern struct _FILE *stdin;
extern FILE *stdin;
#endif
+#define bool _Bool
+
int fscanf(FILE *restrict stream, const char *restrict format, ...);
int sprintf(char *str, const char *format, ...);
void setproctitle(const char *fmt, ...);
@@ -346,6 +348,7 @@ void mySource2(int*);
void myScanf(const char*, ...);
int myPropagator(int, int*);
int mySnprintf(char*, size_t, const char*, ...);
+bool isOutOfRange(const int*);
void mySink(int, int, int);
void testConfigurationSources1() {
@@ -372,6 +375,13 @@ void testConfigurationPropagation() {
Buffer[y] = 1; // expected-warning {{Out of bound memory access }}
}
+void testConfigurationFilter() {
+ int x = mySource1();
+ if (isOutOfRange(&x)) // the filter function
+ return;
+ Buffer[x] = 1; // no-warning
+}
+
void testConfigurationSinks() {
int x = mySource1();
mySink(x, 1, 2);
OpenPOWER on IntegriCloud