File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
cpp/ql/test/library-tests/dataflow/fields Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ void sink (void * o );
2+ void * user_input (void );
3+
4+ struct AB {
5+ void * a ;
6+ void * b ;
7+ };
8+
9+ struct Outer {
10+ struct AB nestedAB ;
11+ struct AB * pointerAB ;
12+ };
13+
14+ void absink (struct AB * ab ) {
15+ sink (ab -> a ); // flow x3 [NOT DETECTED]
16+ sink (ab -> b ); // no flow
17+ }
18+
19+ int struct_init (void ) {
20+ struct AB ab = { user_input (), 0 };
21+
22+ sink (ab .a ); // flow [NOT DETECTED]
23+ sink (ab .b ); // no flow
24+ absink (& ab );
25+
26+ struct Outer outer = {
27+ { user_input (), 0 },
28+ & ab ,
29+ };
30+
31+ sink (outer .nestedAB .a ); // flow [NOT DETECTED]
32+ sink (outer .nestedAB .b ); // no flow
33+ sink (outer .pointerAB -> a ); // flow [NOT DETECTED]
34+ sink (outer .pointerAB -> b ); // no flow
35+
36+ absink (& outer .nestedAB );
37+ absink (outer .pointerAB );
38+ }
You can’t perform that action at this time.
0 commit comments