Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 144c19d

Browse files
committed
C++: Add a test of SummaryCalls, SummarizedCallables and sourceCallables.
1 parent a8742ea commit 144c19d

2 files changed

Lines changed: 228 additions & 0 deletions

File tree

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
summaryCalls
2+
| file://:0:0:0:0 | [summary] call to [summary param] 0 in madCallArg0ReturnToReturn in madCallArg0ReturnToReturn |
3+
| file://:0:0:0:0 | [summary] call to [summary param] 0 in madCallArg0ReturnToReturnFirst in madCallArg0ReturnToReturnFirst |
4+
| file://:0:0:0:0 | [summary] call to [summary param] 0 in madCallArg0WithValue in madCallArg0WithValue |
5+
summarizedCallables
6+
| tests.cpp:130:5:130:19 | madArg0ToReturn |
7+
| tests.cpp:131:6:131:28 | madArg0ToReturnIndirect |
8+
| tests.cpp:133:5:133:28 | madArg0ToReturnValueFlow |
9+
| tests.cpp:134:5:134:27 | madArg0IndirectToReturn |
10+
| tests.cpp:135:5:135:33 | madArg0DoubleIndirectToReturn |
11+
| tests.cpp:136:5:136:30 | madArg0NotIndirectToReturn |
12+
| tests.cpp:137:6:137:26 | madArg0ToArg1Indirect |
13+
| tests.cpp:138:6:138:34 | madArg0IndirectToArg1Indirect |
14+
| tests.cpp:139:5:139:18 | madArgsComplex |
15+
| tests.cpp:140:5:140:14 | madArgsAny |
16+
| tests.cpp:141:5:141:28 | madAndImplementedComplex |
17+
| tests.cpp:146:5:146:24 | madArg0FieldToReturn |
18+
| tests.cpp:147:5:147:32 | madArg0IndirectFieldToReturn |
19+
| tests.cpp:148:5:148:32 | madArg0FieldIndirectToReturn |
20+
| tests.cpp:149:13:149:32 | madArg0ToReturnField |
21+
| tests.cpp:150:14:150:41 | madArg0ToReturnIndirectField |
22+
| tests.cpp:151:13:151:40 | madArg0ToReturnFieldIndirect |
23+
| tests.cpp:270:7:270:19 | madArg0ToSelf |
24+
| tests.cpp:271:6:271:20 | madSelfToReturn |
25+
| tests.cpp:273:7:273:20 | madArg0ToField |
26+
| tests.cpp:274:6:274:21 | madFieldToReturn |
27+
| tests.cpp:299:7:299:30 | namespaceMadSelfToReturn |
28+
| tests.cpp:420:5:420:29 | madCallArg0ReturnToReturn |
29+
| tests.cpp:421:9:421:38 | madCallArg0ReturnToReturnFirst |
30+
| tests.cpp:422:6:422:25 | madCallArg0WithValue |
31+
sourceCallables
32+
| tests.cpp:3:5:3:10 | source |
33+
| tests.cpp:4:6:4:14 | sourcePtr |
34+
| tests.cpp:5:6:5:19 | sourceIndirect |
35+
| tests.cpp:6:6:6:9 | sink |
36+
| tests.cpp:6:15:6:17 | val |
37+
| tests.cpp:7:6:7:9 | sink |
38+
| tests.cpp:7:16:7:18 | ptr |
39+
| tests.cpp:11:5:11:18 | localMadSource |
40+
| tests.cpp:12:5:12:19 | remoteMadSource |
41+
| tests.cpp:13:5:13:14 | notASource |
42+
| tests.cpp:14:5:14:22 | localMadSourceVoid |
43+
| tests.cpp:15:5:15:25 | localMadSourceHasBody |
44+
| tests.cpp:16:6:16:28 | remoteMadSourceIndirect |
45+
| tests.cpp:17:7:17:35 | remoteMadSourceDoubleIndirect |
46+
| tests.cpp:18:6:18:32 | remoteMadSourceIndirectArg0 |
47+
| tests.cpp:18:39:18:39 | x |
48+
| tests.cpp:18:47:18:47 | y |
49+
| tests.cpp:19:6:19:32 | remoteMadSourceIndirectArg1 |
50+
| tests.cpp:19:39:19:39 | x |
51+
| tests.cpp:19:47:19:47 | y |
52+
| tests.cpp:20:5:20:22 | remoteMadSourceVar |
53+
| tests.cpp:21:6:21:31 | remoteMadSourceVarIndirect |
54+
| tests.cpp:24:6:24:28 | namespaceLocalMadSource |
55+
| tests.cpp:25:6:25:31 | namespaceLocalMadSourceVar |
56+
| tests.cpp:28:7:28:30 | namespace2LocalMadSource |
57+
| tests.cpp:31:6:31:19 | localMadSource |
58+
| tests.cpp:33:5:33:27 | namespaceLocalMadSource |
59+
| tests.cpp:35:6:35:17 | test_sources |
60+
| tests.cpp:49:6:49:6 | a |
61+
| tests.cpp:49:9:49:9 | b |
62+
| tests.cpp:49:12:49:12 | c |
63+
| tests.cpp:49:15:49:15 | d |
64+
| tests.cpp:61:6:61:6 | e |
65+
| tests.cpp:71:6:71:26 | remoteMadSourceParam0 |
66+
| tests.cpp:71:32:71:32 | x |
67+
| tests.cpp:78:6:78:16 | madSinkArg0 |
68+
| tests.cpp:78:22:78:22 | x |
69+
| tests.cpp:79:6:79:13 | notASink |
70+
| tests.cpp:79:19:79:19 | x |
71+
| tests.cpp:80:6:80:16 | madSinkArg1 |
72+
| tests.cpp:80:22:80:22 | x |
73+
| tests.cpp:80:29:80:29 | y |
74+
| tests.cpp:81:6:81:17 | madSinkArg01 |
75+
| tests.cpp:81:23:81:23 | x |
76+
| tests.cpp:81:30:81:30 | y |
77+
| tests.cpp:81:37:81:37 | z |
78+
| tests.cpp:82:6:82:17 | madSinkArg02 |
79+
| tests.cpp:82:23:82:23 | x |
80+
| tests.cpp:82:30:82:30 | y |
81+
| tests.cpp:82:37:82:37 | z |
82+
| tests.cpp:83:6:83:24 | madSinkIndirectArg0 |
83+
| tests.cpp:83:31:83:31 | x |
84+
| tests.cpp:84:6:84:30 | madSinkDoubleIndirectArg0 |
85+
| tests.cpp:84:38:84:38 | x |
86+
| tests.cpp:85:5:85:14 | madSinkVar |
87+
| tests.cpp:86:6:86:23 | madSinkVarIndirect |
88+
| tests.cpp:88:6:88:15 | test_sinks |
89+
| tests.cpp:102:6:102:6 | a |
90+
| tests.cpp:103:7:103:11 | a_ptr |
91+
| tests.cpp:118:6:118:18 | madSinkParam0 |
92+
| tests.cpp:118:24:118:24 | x |
93+
| tests.cpp:124:8:124:8 | operator= |
94+
| tests.cpp:124:8:124:8 | operator= |
95+
| tests.cpp:124:8:124:18 | MyContainer |
96+
| tests.cpp:125:6:125:10 | value |
97+
| tests.cpp:126:6:126:11 | value2 |
98+
| tests.cpp:127:7:127:9 | ptr |
99+
| tests.cpp:130:25:130:25 | x |
100+
| tests.cpp:131:34:131:34 | x |
101+
| tests.cpp:132:5:132:15 | notASummary |
102+
| tests.cpp:132:21:132:21 | x |
103+
| tests.cpp:133:34:133:34 | x |
104+
| tests.cpp:134:34:134:34 | x |
105+
| tests.cpp:135:41:135:41 | x |
106+
| tests.cpp:136:37:136:37 | x |
107+
| tests.cpp:137:32:137:32 | x |
108+
| tests.cpp:137:40:137:40 | y |
109+
| tests.cpp:138:47:138:47 | x |
110+
| tests.cpp:138:55:138:55 | y |
111+
| tests.cpp:139:25:139:25 | a |
112+
| tests.cpp:139:33:139:33 | b |
113+
| tests.cpp:139:40:139:40 | c |
114+
| tests.cpp:139:47:139:47 | d |
115+
| tests.cpp:140:20:140:20 | a |
116+
| tests.cpp:140:28:140:28 | b |
117+
| tests.cpp:141:34:141:34 | a |
118+
| tests.cpp:141:41:141:41 | b |
119+
| tests.cpp:141:48:141:48 | c |
120+
| tests.cpp:146:38:146:39 | mc |
121+
| tests.cpp:147:47:147:48 | mc |
122+
| tests.cpp:148:46:148:47 | mc |
123+
| tests.cpp:149:38:149:38 | x |
124+
| tests.cpp:150:47:150:47 | x |
125+
| tests.cpp:151:46:151:46 | x |
126+
| tests.cpp:153:13:153:30 | madFieldToFieldVar |
127+
| tests.cpp:154:13:154:38 | madFieldToIndirectFieldVar |
128+
| tests.cpp:155:14:155:39 | madIndirectFieldToFieldVar |
129+
| tests.cpp:157:6:157:19 | test_summaries |
130+
| tests.cpp:160:6:160:6 | a |
131+
| tests.cpp:160:9:160:9 | b |
132+
| tests.cpp:160:12:160:12 | c |
133+
| tests.cpp:160:15:160:15 | d |
134+
| tests.cpp:160:18:160:18 | e |
135+
| tests.cpp:161:7:161:11 | a_ptr |
136+
| tests.cpp:204:14:204:16 | mc1 |
137+
| tests.cpp:204:19:204:21 | mc2 |
138+
| tests.cpp:223:15:223:18 | rtn1 |
139+
| tests.cpp:226:14:226:17 | rtn2 |
140+
| tests.cpp:227:7:227:14 | rtn2_ptr |
141+
| tests.cpp:253:7:253:7 | operator= |
142+
| tests.cpp:253:7:253:7 | operator= |
143+
| tests.cpp:253:7:253:13 | MyClass |
144+
| tests.cpp:256:6:256:26 | memberRemoteMadSource |
145+
| tests.cpp:257:7:257:39 | memberRemoteMadSourceIndirectArg0 |
146+
| tests.cpp:257:46:257:46 | x |
147+
| tests.cpp:258:6:258:29 | memberRemoteMadSourceVar |
148+
| tests.cpp:259:7:259:21 | qualifierSource |
149+
| tests.cpp:260:7:260:26 | qualifierFieldSource |
150+
| tests.cpp:263:7:263:23 | memberMadSinkArg0 |
151+
| tests.cpp:263:29:263:29 | x |
152+
| tests.cpp:264:6:264:21 | memberMadSinkVar |
153+
| tests.cpp:265:7:265:19 | qualifierSink |
154+
| tests.cpp:266:7:266:23 | qualifierArg0Sink |
155+
| tests.cpp:266:29:266:29 | x |
156+
| tests.cpp:267:7:267:24 | qualifierFieldSink |
157+
| tests.cpp:270:25:270:25 | x |
158+
| tests.cpp:272:6:272:16 | notASummary |
159+
| tests.cpp:273:26:273:26 | x |
160+
| tests.cpp:276:6:276:8 | val |
161+
| tests.cpp:279:7:279:7 | MyDerivedClass |
162+
| tests.cpp:279:7:279:7 | operator= |
163+
| tests.cpp:279:7:279:7 | operator= |
164+
| tests.cpp:279:7:279:20 | MyDerivedClass |
165+
| tests.cpp:281:6:281:28 | subtypeRemoteMadSource1 |
166+
| tests.cpp:282:6:282:21 | subtypeNonSource |
167+
| tests.cpp:283:6:283:28 | subtypeRemoteMadSource2 |
168+
| tests.cpp:286:9:286:15 | source2 |
169+
| tests.cpp:287:6:287:9 | sink |
170+
| tests.cpp:287:19:287:20 | mc |
171+
| tests.cpp:290:8:290:8 | operator= |
172+
| tests.cpp:290:8:290:8 | operator= |
173+
| tests.cpp:290:8:290:14 | MyClass |
174+
| tests.cpp:293:8:293:33 | namespaceMemberMadSinkArg0 |
175+
| tests.cpp:293:39:293:39 | x |
176+
| tests.cpp:294:15:294:46 | namespaceStaticMemberMadSinkArg0 |
177+
| tests.cpp:294:52:294:52 | x |
178+
| tests.cpp:295:7:295:31 | namespaceMemberMadSinkVar |
179+
| tests.cpp:296:14:296:44 | namespaceStaticMemberMadSinkVar |
180+
| tests.cpp:303:22:303:28 | source3 |
181+
| tests.cpp:305:6:305:23 | test_class_members |
182+
| tests.cpp:306:10:306:11 | mc |
183+
| tests.cpp:306:14:306:16 | mc2 |
184+
| tests.cpp:306:19:306:21 | mc3 |
185+
| tests.cpp:306:24:306:26 | mc4 |
186+
| tests.cpp:306:29:306:31 | mc5 |
187+
| tests.cpp:306:34:306:36 | mc6 |
188+
| tests.cpp:306:39:306:41 | mc7 |
189+
| tests.cpp:306:44:306:46 | mc8 |
190+
| tests.cpp:306:49:306:51 | mc9 |
191+
| tests.cpp:306:54:306:57 | mc10 |
192+
| tests.cpp:306:60:306:63 | mc11 |
193+
| tests.cpp:307:11:307:13 | ptr |
194+
| tests.cpp:307:17:307:23 | mc4_ptr |
195+
| tests.cpp:308:17:308:19 | mdc |
196+
| tests.cpp:309:23:309:25 | mnc |
197+
| tests.cpp:309:28:309:31 | mnc2 |
198+
| tests.cpp:310:24:310:31 | mnc2_ptr |
199+
| tests.cpp:316:6:316:6 | a |
200+
| tests.cpp:415:8:415:8 | operator= |
201+
| tests.cpp:415:8:415:8 | operator= |
202+
| tests.cpp:415:8:415:14 | intPair |
203+
| tests.cpp:416:6:416:10 | first |
204+
| tests.cpp:417:6:417:11 | second |
205+
| tests.cpp:420:37:420:43 | fun_ptr |
206+
| tests.cpp:421:46:421:52 | fun_ptr |
207+
| tests.cpp:422:34:422:40 | fun_ptr |
208+
| tests.cpp:422:53:422:57 | value |
209+
| tests.cpp:424:5:424:14 | getTainted |
210+
| tests.cpp:425:6:425:13 | useValue |
211+
| tests.cpp:425:19:425:19 | x |
212+
| tests.cpp:427:6:427:27 | test_function_pointers |
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import testModels
2+
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate
3+
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
4+
5+
query predicate summaryCalls(SummaryCall c) {
6+
any()
7+
}
8+
9+
query predicate summarizedCallables(DataFlowCallable c) {
10+
c = TSummarizedCallable(_)
11+
}
12+
13+
query predicate sourceCallables(DataFlowCallable c) {
14+
c = TSourceCallable(_) and
15+
c.getLocation().getFile().toString() != ""
16+
}

0 commit comments

Comments
 (0)