File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
cpp/ql/test/library-tests/dataflow/dataflow-tests Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -130,3 +130,46 @@ namespace virtual_inheritance {
130130 sink (topRef.isSource ()); // flow [NOT DETECTED]
131131 }
132132}
133+
134+ union union_with_sink_fun_ptrs {
135+ SinkFunctionType f;
136+ SinkFunctionType g;
137+ } u;
138+
139+ void call_sink_through_union_field_f (SinkFunctionType func) {
140+ func (source ());
141+ }
142+
143+ void call_sink_through_union_field_g (SinkFunctionType func) {
144+ func (source ());
145+ }
146+
147+ void set_global_union_field_f () {
148+ u.f = callSink;
149+ }
150+
151+ void test_call_sink_through_union () {
152+ set_global_union_field_f ();
153+ call_sink_through_union_field_f (u.f );
154+ call_sink_through_union_field_g (u.g );
155+ }
156+
157+ union { union_with_sink_fun_ptrs u; } u2;
158+
159+ void call_sink_through_union_field_u_g (SinkFunctionType func) {
160+ func (source ());
161+ }
162+
163+ void call_sink_through_union_field_u_f (SinkFunctionType func) {
164+ func (source ());
165+ }
166+
167+ void set_global_union_field_u_f () {
168+ u2.u .f = callSink;
169+ }
170+
171+ void test_call_sink_through_union_2 () {
172+ set_global_union_field_u_f ();
173+ call_sink_through_union_field_u_f (u2.u .f ); // flow [NOT DETECTED]
174+ call_sink_through_union_field_u_g (u2.u .g ); // flow [NOT DETECTED]
175+ }
You can’t perform that action at this time.
0 commit comments