C++: Properly track smart pointer wrappers.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-02-21 14:29:31 +00:00
parent 64abf5b163
commit 5a8b900394
5 changed files with 23 additions and 7 deletions

View File

@@ -85,11 +85,11 @@ struct B {
void test_operator_arrow(std::unique_ptr<A> p, std::unique_ptr<B> q) {
p->x = source();
sink(p->x); // $ ast MISSING: ir
sink(p->x); // $ ast,ir
sink(p->y);
q->a1.x = source();
sink(q->a1.x); // $ ast MISSING: ir
sink(q->a1.x); // $ ast,ir
sink(q->a1.y);
sink(q->a2.x);
}
@@ -101,7 +101,7 @@ void taint_x(A* pa) {
void reverse_taint_smart_pointer() {
std::unique_ptr<A> p = std::unique_ptr<A>(new A);
taint_x(p.get());
sink(p->x); // $ ast MISSING: ir
sink(p->x); // $ ast,ir
}
struct C {
@@ -131,7 +131,7 @@ int nested_shared_ptr_taint(std::shared_ptr<C> p1, std::unique_ptr<std::shared_p
int nested_shared_ptr_taint_cref(std::shared_ptr<C> p1, std::unique_ptr<std::shared_ptr<int>> p2) {
taint_x_shared_cref(p1->q);
sink(p1->q->x); // $ ast MISSING: ir
sink(p1->q->x); // $ ast,ir
getNumberCRef(*p2);
sink(**p2); // $ ast,ir