mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
C++: Replace the new rules in DataFlowUtil with a dataflow model for pointer wrapper classes.
This commit is contained in:
@@ -9,7 +9,7 @@ template<typename T> void sink(std::unique_ptr<T>&);
|
||||
|
||||
void test_make_shared() {
|
||||
std::shared_ptr<int> p = std::make_shared<int>(source());
|
||||
sink(*p); // $ ast MISSING: ir
|
||||
sink(*p); // $ ast,ir
|
||||
sink(p); // $ ast,ir
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ void test_make_shared_array() {
|
||||
|
||||
void test_make_unique() {
|
||||
std::unique_ptr<int> p = std::make_unique<int>(source());
|
||||
sink(*p); // $ ast MISSING: ir
|
||||
sink(*p); // $ ast,ir
|
||||
sink(p); // $ ast,ir
|
||||
}
|
||||
|
||||
@@ -83,3 +83,13 @@ void test_operator_arrow(std::unique_ptr<A> p, std::unique_ptr<B> q) {
|
||||
sink(q->a1.y);
|
||||
sink(q->a2.x);
|
||||
}
|
||||
|
||||
void taint_x(A* pa) {
|
||||
pa->x = source();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user