Files
codeql/cpp/ql/test/library-tests/dataflow/fields/struct_init.c
Jonas Jensen 5f0d283212 Merge remote-tracking branch 'upstream/master' into dataflow-indirect-args
The conflicts came from how `this` is now a parameter but not a
`Parameter` on `master`.

Conflicts:
	cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
	cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/defaulttainttracking.cpp
	cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/tainted.expected
	cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/test_diff.expected
	cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected
	cpp/ql/test/library-tests/dataflow/fields/ir-flow.expected
	cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected
2020-06-02 15:35:02 +02:00

48 lines
803 B
C

void sink(void *o);
void *user_input(void);
struct AB {
void *a;
void *b;
};
struct Outer {
struct AB nestedAB;
struct AB *pointerAB;
};
void absink(struct AB *ab) {
sink(ab->a); //$ast,ir=20:20 $ast,ir=27:7 $ast=40:20 $f-:ir
sink(ab->b); // no flow
}
int struct_init(void) {
struct AB ab = { user_input(), 0 };
sink(ab.a); //$ast,ir
sink(ab.b); // no flow
absink(&ab);
struct Outer outer = {
{ user_input(), 0 },
&ab,
};
sink(outer.nestedAB.a); //$ast,ir
sink(outer.nestedAB.b); // no flow
sink(outer.pointerAB->a); //$ast $f-:ir
sink(outer.pointerAB->b); // no flow
absink(&outer.nestedAB);
}
int struct_init2(void) {
struct AB ab = { user_input(), 0 };
struct Outer outer = {
{ user_input(), 0 },
&ab,
};
absink(outer.pointerAB);
}