mirror of
https://github.com/github/codeql.git
synced 2026-07-02 18:15:33 +02:00
C++: Add tests with missing reverse flow.
This commit is contained in:
@@ -21,4 +21,7 @@ extensions:
|
||||
- ["", "", False, "callWithNonTypeTemplate<T>", "(const T &)", "", "Argument[*0]", "ReturnValue", "value", "manual"]
|
||||
- ["", "TemplateClass1<T>", False, "templateFunction<U>", "(T,U)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
- ["", "TemplateClass1", True, "templateFunction2<U,V>", "(U,V)", "", "Argument[1]", "ReturnValue", "value", "manual"]
|
||||
- ["", "TemplateClass2<T,U>", True, "function", "(U,T)", "", "Argument[1]", "ReturnValue", "value", "manual"]
|
||||
- ["", "TemplateClass2<T,U>", True, "function", "(U,T)", "", "Argument[1]", "ReturnValue", "value", "manual"]
|
||||
- ["", "ReverseFlow", True, "get_ptr", "", "", "ReturnValue[*]", "Argument[-1].Field[value]", "value", "manual"]
|
||||
- ["", "MyString", True, "operator[]", "", "", "ReturnValue[*]", "Argument[-1]", "taint", "manual"]
|
||||
- ["", "MyString", True, "operator[]", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"]
|
||||
@@ -19,3 +19,5 @@
|
||||
| test.cpp:149:10:149:10 | z | test-sink |
|
||||
| test.cpp:158:10:158:10 | z | test-sink |
|
||||
| test.cpp:173:10:173:10 | y | test-sink |
|
||||
| test.cpp:190:11:190:11 | x | test-sink |
|
||||
| test.cpp:196:11:196:11 | c | test-sink |
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
| test.cpp:146:10:146:18 | call to ymlSource | local |
|
||||
| test.cpp:155:10:155:18 | call to ymlSource | local |
|
||||
| test.cpp:170:10:170:18 | call to ymlSource | local |
|
||||
| test.cpp:188:18:188:26 | call to ymlSource | local |
|
||||
| test.cpp:194:10:194:20 | call to ymlSource | local |
|
||||
| windows.cpp:22:15:22:29 | *call to GetCommandLineA | local |
|
||||
| windows.cpp:34:17:34:38 | *call to GetEnvironmentStringsA | local |
|
||||
| windows.cpp:39:36:39:38 | GetEnvironmentVariableA output argument | local |
|
||||
|
||||
@@ -171,4 +171,28 @@ void test_class1() {
|
||||
Class1<int> c;
|
||||
auto y = c.templateFunction3<unsigned long>(0UL, x);
|
||||
ymlSink(y); // $ ir
|
||||
}
|
||||
|
||||
struct ReverseFlow {
|
||||
int value;
|
||||
int& get_ptr();
|
||||
};
|
||||
|
||||
struct MyString {
|
||||
char& operator[](unsigned);
|
||||
};
|
||||
|
||||
void test_reverse_flow(unsigned i, unsigned j) {
|
||||
{
|
||||
ReverseFlow rf;
|
||||
rf.get_ptr() = ymlSource();
|
||||
int x = rf.value;
|
||||
ymlSink(x); // $ MISSING: ir
|
||||
}
|
||||
{
|
||||
MyString s;
|
||||
s[i] = ymlSource();
|
||||
char c = s[j];
|
||||
ymlSink(c); // $ MISSING: ir
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user