summaryrefslogtreecommitdiff
path: root/test/Analysis/taint-tester.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/taint-tester.c')
-rw-r--r--test/Analysis/taint-tester.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Analysis/taint-tester.c b/test/Analysis/taint-tester.c
index f1dd5d0f03..8a82cd397a 100644
--- a/test/Analysis/taint-tester.c
+++ b/test/Analysis/taint-tester.c
@@ -55,3 +55,18 @@ void taintTracking(int x) {
int ty = xy.y; // FIXME: This should be tainted as well.
char ntz = xy.z;// no warning
}
+
+void BitwiseOp(int in, char inn) {
+ // Taint on bitwise operations, integer to integer cast.
+ int m;
+ int x = 0;
+ scanf("%d", &x);
+ int y = (in << (x << in)) * 5;// expected-warning 4 {{tainted}}
+ // The next line tests integer to integer cast.
+ int z = y & inn; // expected-warning 2 {{tainted}}
+ if (y == 5) // expected-warning 2 {{tainted}}
+ m = z | z;// expected-warning 4 {{tainted}}
+ else
+ m = inn;
+ int mm = m; // expected-warning {{tainted}}
+}