]> granicus.if.org Git - clang/commitdiff
[analyzer] Add another tests to taint tester.
authorAnna Zaks <ganna@apple.com>
Wed, 4 Jan 2012 23:54:04 +0000 (23:54 +0000)
committerAnna Zaks <ganna@apple.com>
Wed, 4 Jan 2012 23:54:04 +0000 (23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147570 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/taint-tester.c

index 4aa170ce21c9720929f379afe75c3c7e760486ec..1f97fbab0fb2f36a8a236186313db8f33b7fec51 100644 (file)
@@ -151,6 +151,15 @@ void stdinTest3() {
   int jjj = iii;// expected-warning + {{tainted}}
 }
 
+// Test that stdin does not get invalidated by calls.
+void foo();
+void stdinTest4() {
+  int i;
+  fscanf(stdin, "%d", &i);
+  foo();
+  int j = i; // expected-warning + {{tainted}}
+}
+
 // Test propagation functions - the ones that propagate taint from arguments to
 // return value, ptr arguments.