mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
C++: Annotation field flow tests with [IR] and [AST]
This commit is contained in:
@@ -12,32 +12,32 @@ struct Outer {
|
||||
};
|
||||
|
||||
void absink(struct AB *ab) {
|
||||
sink(ab->a); // flow (three sources)
|
||||
sink(ab->a); // flow from (1), (2), (3) [NOT DETECTED by IR]
|
||||
sink(ab->b); // no flow
|
||||
}
|
||||
|
||||
int struct_init(void) {
|
||||
struct AB ab = { user_input(), 0 };
|
||||
struct AB ab = { user_input(), 0 }; // (1)
|
||||
|
||||
sink(ab.a); // flow
|
||||
sink(ab.b); // no flow
|
||||
absink(&ab);
|
||||
|
||||
struct Outer outer = {
|
||||
{ user_input(), 0 },
|
||||
{ user_input(), 0 }, // (2)
|
||||
&ab,
|
||||
};
|
||||
|
||||
sink(outer.nestedAB.a); // flow
|
||||
sink(outer.nestedAB.b); // no flow
|
||||
sink(outer.pointerAB->a); // flow
|
||||
sink(outer.pointerAB->a); // flow [NOT DETECTED by IR]
|
||||
sink(outer.pointerAB->b); // no flow
|
||||
|
||||
absink(&outer.nestedAB);
|
||||
}
|
||||
|
||||
int struct_init2(void) {
|
||||
struct AB ab = { user_input(), 0 };
|
||||
struct AB ab = { user_input(), 0 }; // (3)
|
||||
struct Outer outer = {
|
||||
{ user_input(), 0 },
|
||||
&ab,
|
||||
|
||||
Reference in New Issue
Block a user