C++: Add memcpy(vector test.

This commit is contained in:
Geoffrey White
2020-10-22 09:46:07 +01:00
parent 227bf91626
commit 3cca8443f8
4 changed files with 36 additions and 0 deletions

View File

@@ -7038,3 +7038,24 @@
| vector.cpp:399:33:399:35 | i11 [post update] | vector.cpp:400:7:400:9 | v11 | |
| vector.cpp:399:33:399:35 | i11 [post update] | vector.cpp:401:1:401:1 | v11 | |
| vector.cpp:400:7:400:9 | ref arg v11 | vector.cpp:401:1:401:1 | v11 | |
| vector.cpp:407:21:407:24 | call to vector | vector.cpp:411:7:411:7 | v | |
| vector.cpp:407:21:407:24 | call to vector | vector.cpp:412:10:412:10 | v | |
| vector.cpp:407:21:407:24 | call to vector | vector.cpp:413:7:413:7 | v | |
| vector.cpp:407:21:407:24 | call to vector | vector.cpp:414:1:414:1 | v | |
| vector.cpp:408:10:408:15 | call to source | vector.cpp:412:17:412:17 | s | |
| vector.cpp:409:9:409:10 | 0 | vector.cpp:412:12:412:12 | i | |
| vector.cpp:411:7:411:7 | ref arg v | vector.cpp:412:10:412:10 | v | |
| vector.cpp:411:7:411:7 | ref arg v | vector.cpp:413:7:413:7 | v | |
| vector.cpp:411:7:411:7 | ref arg v | vector.cpp:414:1:414:1 | v | |
| vector.cpp:412:9:412:13 | & ... | vector.cpp:412:2:412:7 | call to memcpy | |
| vector.cpp:412:9:412:13 | ref arg & ... | vector.cpp:412:11:412:11 | call to operator[] [inner post update] | |
| vector.cpp:412:10:412:10 | ref arg v | vector.cpp:413:7:413:7 | v | |
| vector.cpp:412:10:412:10 | ref arg v | vector.cpp:414:1:414:1 | v | |
| vector.cpp:412:10:412:10 | v | vector.cpp:412:11:412:11 | call to operator[] | TAINT |
| vector.cpp:412:11:412:11 | call to operator[] | vector.cpp:412:9:412:13 | & ... | |
| vector.cpp:412:11:412:11 | call to operator[] [inner post update] | vector.cpp:412:10:412:10 | ref arg v | TAINT |
| vector.cpp:412:16:412:17 | & ... | vector.cpp:412:2:412:7 | call to memcpy | TAINT |
| vector.cpp:412:16:412:17 | & ... | vector.cpp:412:9:412:13 | ref arg & ... | TAINT |
| vector.cpp:412:17:412:17 | s | vector.cpp:412:9:412:13 | ref arg & ... | |
| vector.cpp:412:17:412:17 | s | vector.cpp:412:16:412:17 | & ... | |
| vector.cpp:413:7:413:7 | ref arg v | vector.cpp:414:1:414:1 | v | |

View File

@@ -653,3 +653,4 @@
| vector.cpp:392:7:392:8 | v9 | vector.cpp:330:10:330:15 | call to source |
| vector.cpp:392:7:392:8 | v9 | vector.cpp:389:8:389:13 | call to source |
| vector.cpp:400:7:400:9 | v11 | vector.cpp:399:38:399:43 | call to source |
| vector.cpp:413:7:413:7 | v | vector.cpp:408:10:408:15 | call to source |

View File

@@ -379,3 +379,4 @@
| vector.cpp:392:7:392:8 | vector.cpp:330:10:330:15 | AST only |
| vector.cpp:392:7:392:8 | vector.cpp:389:8:389:13 | AST only |
| vector.cpp:400:7:400:9 | vector.cpp:399:38:399:43 | AST only |
| vector.cpp:413:7:413:7 | vector.cpp:408:10:408:15 | AST only |

View File

@@ -399,3 +399,16 @@ void test_vector_output_iterator(int b) {
vector_iterator_assign_wrapper(i11, source());
sink(v11); // tainted [NOT DETECTED by IR]
}
void *memcpy(void *s1, const void *s2, size_t n);
void test_vector_memcpy()
{
std::vector<int> v(100);
int s = source();
int i = 0;
sink(v);
memcpy(&v[i], &s, sizeof(int));
sink(v); // tainted [NOT DETECTED by IR]
}