aboutsummaryrefslogtreecommitdiff
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
commit5238474707de2c9a08465429bbb083be15b8e81a (patch)
treeeaf94bbab5abd8f034c1b2b20f9096a87ff0972e
parent9ffbe243cca46082b4a59b5c3be454ab0c455378 (diff)
[analyzer] Fixup for r146793. Add tests for atol and atoll.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146794 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/taint-tester.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/Analysis/taint-tester.c b/test/Analysis/taint-tester.c
index 85a59c50ae..02afe6d4f2 100644
--- a/test/Analysis/taint-tester.c
+++ b/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}}
+
}