File tree Expand file tree Collapse file tree 5 files changed +37
-0
lines changed
cpp/ql/test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree 5 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 161161| taint.cpp:194:10:194:10 | x | taint.cpp:194:9:194:10 | & ... | TAINT |
162162| taint.cpp:194:13:194:18 | source | taint.cpp:194:9:194:10 | ref arg & ... | TAINT |
163163| taint.cpp:194:21:194:31 | sizeof(int) | taint.cpp:194:9:194:10 | ref arg & ... | TAINT |
164+ | taint.cpp:207:6:207:11 | call to source | taint.cpp:207:2:207:13 | ... = ... | |
165+ | taint.cpp:207:6:207:11 | call to source | taint.cpp:210:7:210:7 | x | |
166+ | taint.cpp:207:6:207:11 | call to source | taint.cpp:213:12:213:12 | x | |
167+ | taint.cpp:207:6:207:11 | call to source | taint.cpp:215:7:215:7 | x | |
168+ | taint.cpp:208:6:208:6 | 0 | taint.cpp:208:2:208:6 | ... = ... | |
169+ | taint.cpp:208:6:208:6 | 0 | taint.cpp:211:7:211:7 | y | |
170+ | taint.cpp:208:6:208:6 | 0 | taint.cpp:213:15:213:15 | y | |
171+ | taint.cpp:208:6:208:6 | 0 | taint.cpp:216:7:216:7 | y | |
172+ | taint.cpp:213:12:213:12 | ref arg x | taint.cpp:213:12:213:12 | x | |
173+ | taint.cpp:213:12:213:12 | ref arg x | taint.cpp:215:7:215:7 | x | |
174+ | taint.cpp:213:15:213:15 | ref arg y | taint.cpp:213:15:213:15 | y | |
175+ | taint.cpp:213:15:213:15 | ref arg y | taint.cpp:216:7:216:7 | y | |
Original file line number Diff line number Diff line change @@ -194,3 +194,24 @@ void test_memcpy(int *source) {
194194 memcpy (&x, source, sizeof (int ));
195195 sink (x);
196196}
197+
198+ // --- swap ---
199+
200+ namespace std {
201+ template <class T > constexpr void swap (T& a, T& b);
202+ }
203+
204+ void test_swap () {
205+ int x, y;
206+
207+ x = source ();
208+ y = 0 ;
209+
210+ sink (x); // tainted
211+ sink (y);
212+
213+ std::swap (x, y);
214+
215+ sink (x); // [FALSE POSITIVE]
216+ sink (y); // tainted [NOT DETECTED]
217+ }
Original file line number Diff line number Diff line change 1414| taint.cpp:181:8:181:9 | * ... | taint.cpp:185:11:185:16 | call to source |
1515| taint.cpp:195:7:195:7 | x | taint.cpp:192:23:192:28 | source |
1616| taint.cpp:195:7:195:7 | x | taint.cpp:193:6:193:6 | x |
17+ | taint.cpp:210:7:210:7 | x | taint.cpp:207:6:207:11 | call to source |
18+ | taint.cpp:215:7:215:7 | x | taint.cpp:207:6:207:11 | call to source |
Original file line number Diff line number Diff line change 77| taint.cpp:185:11:185:16 | taint.cpp:181:8:181:9 | AST only |
88| taint.cpp:192:23:192:28 | taint.cpp:195:7:195:7 | AST only |
99| taint.cpp:193:6:193:6 | taint.cpp:195:7:195:7 | AST only |
10+ | taint.cpp:207:6:207:11 | taint.cpp:215:7:215:7 | AST only |
Original file line number Diff line number Diff line change 77| taint.cpp:151:7:151:12 | Call: call to select | taint.cpp:151:20:151:25 | Call: call to source |
88| taint.cpp:167:8:167:13 | Call: call to source | taint.cpp:167:8:167:13 | Call: call to source |
99| taint.cpp:168:8:168:14 | Load: tainted | taint.cpp:164:19:164:24 | Call: call to source |
10+ | taint.cpp:210:7:210:7 | Load: x | taint.cpp:207:6:207:11 | Call: call to source |
You can’t perform that action at this time.
0 commit comments