summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/taint-tester.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-12-17 00:30:16 +0000
committerAnna Zaks <ganna@apple.com>2011-12-17 00:30:16 +0000
commit79b5c26014a83374f140b0340d5d4f206c8e5241 (patch)
tree63b72377d88e86b23772356097b9cc4530cc9e7f /clang/test/Analysis/taint-tester.c
parent3b0ab206d27e74bdd94f525c1f6bf11ad1824ba3 (diff)
downloadbcm5719-llvm-79b5c26014a83374f140b0340d5d4f206c8e5241.tar.gz
bcm5719-llvm-79b5c26014a83374f140b0340d5d4f206c8e5241.zip
[analyzer] Fixup for r146793. Add tests for atol and atoll.
llvm-svn: 146794
Diffstat (limited to 'clang/test/Analysis/taint-tester.c')
-rw-r--r--clang/test/Analysis/taint-tester.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/test/Analysis/taint-tester.c b/clang/test/Analysis/taint-tester.c
index 85a59c50ae3..02afe6d4f22 100644
--- a/clang/test/Analysis/taint-tester.c
+++ b/clang/test/Analysis/taint-tester.c
@@ -155,7 +155,6 @@ void stdinTest3() {
// return value, ptr arguments.
int atoi(const char *nptr);
-// TODO: Add support for atol and atoll.
long atol(const char *nptr);
long long atoll(const char *nptr);
@@ -164,5 +163,17 @@ void atoiTest() {
scanf("%s", s);
int d = atoi(s); // expected-warning + {{tainted}}
int td = d; // expected-warning + {{tainted}}
+
+ // TODO: We shouldn't have to redefine the taint source here.
+ char sl[80];
+ scanf("%s", sl);
+ long l = atol(sl); // expected-warning + {{tainted}}
+ int tl = l; // expected-warning + {{tainted}}
+
+ char sll[80];
+ scanf("%s", sll);
+ long long ll = atoll(sll); // expected-warning + {{tainted}}
+ int tll = ll; // expected-warning + {{tainted}}
+
}
OpenPOWER on IntegriCloud