Skip to content

Commit 208cd4c

Browse files
committed
C++: Fix assign in the test stl.h.
1 parent 927a4fa commit 208cd4c

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@
313313
| movableclass.cpp:65:13:65:18 | call to source | movableclass.cpp:65:13:65:20 | call to MyMovableClass | TAINT |
314314
| movableclass.cpp:65:13:65:20 | call to MyMovableClass | movableclass.cpp:65:8:65:9 | ref arg s3 | TAINT |
315315
| movableclass.cpp:65:13:65:20 | call to MyMovableClass | movableclass.cpp:65:11:65:11 | call to operator= | TAINT |
316-
| stl.h:137:30:137:40 | call to allocator | stl.h:137:21:137:41 | noexcept(...) | TAINT |
317-
| stl.h:137:30:137:40 | call to allocator | stl.h:137:21:137:41 | noexcept(...) | TAINT |
318-
| stl.h:137:30:137:40 | call to allocator | stl.h:137:21:137:41 | noexcept(...) | TAINT |
319-
| stl.h:137:30:137:40 | call to allocator | stl.h:137:21:137:41 | noexcept(...) | TAINT |
320-
| stl.h:137:30:137:40 | call to allocator | stl.h:137:21:137:41 | noexcept(...) | TAINT |
321-
| stl.h:137:53:137:63 | 0 | stl.h:137:46:137:64 | (no string representation) | TAINT |
316+
| stl.h:139:30:139:40 | call to allocator | stl.h:139:21:139:41 | noexcept(...) | TAINT |
317+
| stl.h:139:30:139:40 | call to allocator | stl.h:139:21:139:41 | noexcept(...) | TAINT |
318+
| stl.h:139:30:139:40 | call to allocator | stl.h:139:21:139:41 | noexcept(...) | TAINT |
319+
| stl.h:139:30:139:40 | call to allocator | stl.h:139:21:139:41 | noexcept(...) | TAINT |
320+
| stl.h:139:30:139:40 | call to allocator | stl.h:139:21:139:41 | noexcept(...) | TAINT |
321+
| stl.h:139:53:139:63 | 0 | stl.h:139:46:139:64 | (no string representation) | TAINT |
322322
| string.cpp:24:12:24:17 | call to source | string.cpp:28:7:28:7 | a | |
323323
| string.cpp:25:16:25:20 | 123 | string.cpp:25:16:25:21 | call to basic_string | TAINT |
324324
| string.cpp:25:16:25:21 | call to basic_string | string.cpp:29:7:29:7 | b | |
@@ -2246,8 +2246,10 @@
22462246
| vector.cpp:237:2:237:3 | ref arg v1 | vector.cpp:249:13:249:14 | v1 | |
22472247
| vector.cpp:237:2:237:3 | ref arg v1 | vector.cpp:249:25:249:26 | v1 | |
22482248
| vector.cpp:237:2:237:3 | ref arg v1 | vector.cpp:277:1:277:1 | v1 | |
2249+
| vector.cpp:237:17:237:17 | 0 | vector.cpp:237:2:237:3 | ref arg v1 | TAINT |
22492250
| vector.cpp:238:2:238:3 | ref arg v2 | vector.cpp:242:7:242:8 | v2 | |
22502251
| vector.cpp:238:2:238:3 | ref arg v2 | vector.cpp:277:1:277:1 | v2 | |
2252+
| vector.cpp:238:17:238:30 | call to source | vector.cpp:238:2:238:3 | ref arg v2 | TAINT |
22512253
| vector.cpp:239:2:239:3 | ref arg v3 | vector.cpp:243:7:243:8 | v3 | |
22522254
| vector.cpp:239:2:239:3 | ref arg v3 | vector.cpp:250:13:250:14 | v3 | |
22532255
| vector.cpp:239:2:239:3 | ref arg v3 | vector.cpp:250:25:250:26 | v3 | |
@@ -2314,6 +2316,7 @@
23142316
| vector.cpp:267:28:267:29 | call to vector | vector.cpp:276:2:276:2 | v9 | |
23152317
| vector.cpp:269:3:269:4 | ref arg v7 | vector.cpp:273:8:273:9 | v7 | |
23162318
| vector.cpp:269:3:269:4 | ref arg v7 | vector.cpp:276:2:276:2 | v7 | |
2319+
| vector.cpp:269:18:269:31 | call to source | vector.cpp:269:3:269:4 | ref arg v7 | TAINT |
23172320
| vector.cpp:270:3:270:4 | ref arg v8 | vector.cpp:274:8:274:9 | v8 | |
23182321
| vector.cpp:270:3:270:4 | ref arg v8 | vector.cpp:276:2:276:2 | v8 | |
23192322
| vector.cpp:270:18:270:35 | call to source | vector.cpp:270:3:270:4 | ref arg v8 | TAINT |

cpp/ql/test/library-tests/dataflow/taint-tests/stl.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ namespace std
1111

1212
struct ptrdiff_t;
1313

14-
template <class iterator_category,
14+
template <class Category,
1515
class value_type,
1616
class difference_type = ptrdiff_t,
1717
class pointer_type = value_type*,
1818
class reference_type = value_type&>
1919
struct iterator {
20+
typedef Category iterator_category;
21+
2022
iterator &operator++();
2123
iterator operator++(int);
2224
bool operator==(iterator other) const;
@@ -142,7 +144,9 @@ namespace std {
142144

143145
vector& operator=(const vector& x);
144146
vector& operator=(vector&& x) noexcept/*(allocator_traits<Allocator>::propagate_on_container_move_assignment::value || allocator_traits<Allocator>::is_always_equal::value)*/;
145-
template<class InputIterator> void assign(InputIterator first, InputIterator last);
147+
template<class InputIterator, class IteratorCategory = typename InputIterator::iterator_category> void assign(InputIterator first, InputIterator last);
148+
// use of `iterator_category` makes sure InputIterator is (probably) an iterator, and not an `int` or
149+
// similar that should match a different overload (SFINAE).
146150
void assign(size_type n, const T& u);
147151

148152
iterator begin() noexcept;

cpp/ql/test/library-tests/dataflow/taint-tests/taint.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@
241241
| vector.cpp:171:13:171:13 | call to operator[] | vector.cpp:170:14:170:19 | call to source |
242242
| vector.cpp:180:13:180:13 | call to operator[] | vector.cpp:179:14:179:19 | call to source |
243243
| vector.cpp:201:13:201:13 | call to operator[] | vector.cpp:200:14:200:19 | call to source |
244+
| vector.cpp:242:7:242:8 | v2 | vector.cpp:238:17:238:30 | call to source |
244245
| vector.cpp:243:7:243:8 | v3 | vector.cpp:239:15:239:20 | call to source |
246+
| vector.cpp:273:8:273:9 | v7 | vector.cpp:269:18:269:31 | call to source |
245247
| vector.cpp:274:8:274:9 | v8 | vector.cpp:270:18:270:35 | call to source |
246248
| vector.cpp:275:8:275:9 | v9 | vector.cpp:271:18:271:34 | call to source |
247249
| vector.cpp:285:7:285:8 | v1 | vector.cpp:284:15:284:20 | call to source |

cpp/ql/test/library-tests/dataflow/taint-tests/test_diff.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@
177177
| vector.cpp:171:13:171:13 | vector.cpp:170:14:170:19 | AST only |
178178
| vector.cpp:180:13:180:13 | vector.cpp:179:14:179:19 | AST only |
179179
| vector.cpp:201:13:201:13 | vector.cpp:200:14:200:19 | AST only |
180+
| vector.cpp:242:7:242:8 | vector.cpp:238:17:238:30 | AST only |
180181
| vector.cpp:243:7:243:8 | vector.cpp:239:15:239:20 | AST only |
182+
| vector.cpp:273:8:273:9 | vector.cpp:269:18:269:31 | AST only |
181183
| vector.cpp:274:8:274:9 | vector.cpp:270:18:270:35 | AST only |
182184
| vector.cpp:275:8:275:9 | vector.cpp:271:18:271:34 | AST only |
183185
| vector.cpp:285:7:285:8 | vector.cpp:284:15:284:20 | AST only |

0 commit comments

Comments
 (0)