C++: Add a test of SummaryCalls, SummarizedCallables and sourceCallables.

This commit is contained in:
Geoffrey White
2024-04-04 16:05:27 +01:00
parent a8742ea111
commit 144c19db74
2 changed files with 228 additions and 0 deletions

View File

@@ -0,0 +1,212 @@
summaryCalls
| file://:0:0:0:0 | [summary] call to [summary param] 0 in madCallArg0ReturnToReturn in madCallArg0ReturnToReturn |
| file://:0:0:0:0 | [summary] call to [summary param] 0 in madCallArg0ReturnToReturnFirst in madCallArg0ReturnToReturnFirst |
| file://:0:0:0:0 | [summary] call to [summary param] 0 in madCallArg0WithValue in madCallArg0WithValue |
summarizedCallables
| tests.cpp:130:5:130:19 | madArg0ToReturn |
| tests.cpp:131:6:131:28 | madArg0ToReturnIndirect |
| tests.cpp:133:5:133:28 | madArg0ToReturnValueFlow |
| tests.cpp:134:5:134:27 | madArg0IndirectToReturn |
| tests.cpp:135:5:135:33 | madArg0DoubleIndirectToReturn |
| tests.cpp:136:5:136:30 | madArg0NotIndirectToReturn |
| tests.cpp:137:6:137:26 | madArg0ToArg1Indirect |
| tests.cpp:138:6:138:34 | madArg0IndirectToArg1Indirect |
| tests.cpp:139:5:139:18 | madArgsComplex |
| tests.cpp:140:5:140:14 | madArgsAny |
| tests.cpp:141:5:141:28 | madAndImplementedComplex |
| tests.cpp:146:5:146:24 | madArg0FieldToReturn |
| tests.cpp:147:5:147:32 | madArg0IndirectFieldToReturn |
| tests.cpp:148:5:148:32 | madArg0FieldIndirectToReturn |
| tests.cpp:149:13:149:32 | madArg0ToReturnField |
| tests.cpp:150:14:150:41 | madArg0ToReturnIndirectField |
| tests.cpp:151:13:151:40 | madArg0ToReturnFieldIndirect |
| tests.cpp:270:7:270:19 | madArg0ToSelf |
| tests.cpp:271:6:271:20 | madSelfToReturn |
| tests.cpp:273:7:273:20 | madArg0ToField |
| tests.cpp:274:6:274:21 | madFieldToReturn |
| tests.cpp:299:7:299:30 | namespaceMadSelfToReturn |
| tests.cpp:420:5:420:29 | madCallArg0ReturnToReturn |
| tests.cpp:421:9:421:38 | madCallArg0ReturnToReturnFirst |
| tests.cpp:422:6:422:25 | madCallArg0WithValue |
sourceCallables
| tests.cpp:3:5:3:10 | source |
| tests.cpp:4:6:4:14 | sourcePtr |
| tests.cpp:5:6:5:19 | sourceIndirect |
| tests.cpp:6:6:6:9 | sink |
| tests.cpp:6:15:6:17 | val |
| tests.cpp:7:6:7:9 | sink |
| tests.cpp:7:16:7:18 | ptr |
| tests.cpp:11:5:11:18 | localMadSource |
| tests.cpp:12:5:12:19 | remoteMadSource |
| tests.cpp:13:5:13:14 | notASource |
| tests.cpp:14:5:14:22 | localMadSourceVoid |
| tests.cpp:15:5:15:25 | localMadSourceHasBody |
| tests.cpp:16:6:16:28 | remoteMadSourceIndirect |
| tests.cpp:17:7:17:35 | remoteMadSourceDoubleIndirect |
| tests.cpp:18:6:18:32 | remoteMadSourceIndirectArg0 |
| tests.cpp:18:39:18:39 | x |
| tests.cpp:18:47:18:47 | y |
| tests.cpp:19:6:19:32 | remoteMadSourceIndirectArg1 |
| tests.cpp:19:39:19:39 | x |
| tests.cpp:19:47:19:47 | y |
| tests.cpp:20:5:20:22 | remoteMadSourceVar |
| tests.cpp:21:6:21:31 | remoteMadSourceVarIndirect |
| tests.cpp:24:6:24:28 | namespaceLocalMadSource |
| tests.cpp:25:6:25:31 | namespaceLocalMadSourceVar |
| tests.cpp:28:7:28:30 | namespace2LocalMadSource |
| tests.cpp:31:6:31:19 | localMadSource |
| tests.cpp:33:5:33:27 | namespaceLocalMadSource |
| tests.cpp:35:6:35:17 | test_sources |
| tests.cpp:49:6:49:6 | a |
| tests.cpp:49:9:49:9 | b |
| tests.cpp:49:12:49:12 | c |
| tests.cpp:49:15:49:15 | d |
| tests.cpp:61:6:61:6 | e |
| tests.cpp:71:6:71:26 | remoteMadSourceParam0 |
| tests.cpp:71:32:71:32 | x |
| tests.cpp:78:6:78:16 | madSinkArg0 |
| tests.cpp:78:22:78:22 | x |
| tests.cpp:79:6:79:13 | notASink |
| tests.cpp:79:19:79:19 | x |
| tests.cpp:80:6:80:16 | madSinkArg1 |
| tests.cpp:80:22:80:22 | x |
| tests.cpp:80:29:80:29 | y |
| tests.cpp:81:6:81:17 | madSinkArg01 |
| tests.cpp:81:23:81:23 | x |
| tests.cpp:81:30:81:30 | y |
| tests.cpp:81:37:81:37 | z |
| tests.cpp:82:6:82:17 | madSinkArg02 |
| tests.cpp:82:23:82:23 | x |
| tests.cpp:82:30:82:30 | y |
| tests.cpp:82:37:82:37 | z |
| tests.cpp:83:6:83:24 | madSinkIndirectArg0 |
| tests.cpp:83:31:83:31 | x |
| tests.cpp:84:6:84:30 | madSinkDoubleIndirectArg0 |
| tests.cpp:84:38:84:38 | x |
| tests.cpp:85:5:85:14 | madSinkVar |
| tests.cpp:86:6:86:23 | madSinkVarIndirect |
| tests.cpp:88:6:88:15 | test_sinks |
| tests.cpp:102:6:102:6 | a |
| tests.cpp:103:7:103:11 | a_ptr |
| tests.cpp:118:6:118:18 | madSinkParam0 |
| tests.cpp:118:24:118:24 | x |
| tests.cpp:124:8:124:8 | operator= |
| tests.cpp:124:8:124:8 | operator= |
| tests.cpp:124:8:124:18 | MyContainer |
| tests.cpp:125:6:125:10 | value |
| tests.cpp:126:6:126:11 | value2 |
| tests.cpp:127:7:127:9 | ptr |
| tests.cpp:130:25:130:25 | x |
| tests.cpp:131:34:131:34 | x |
| tests.cpp:132:5:132:15 | notASummary |
| tests.cpp:132:21:132:21 | x |
| tests.cpp:133:34:133:34 | x |
| tests.cpp:134:34:134:34 | x |
| tests.cpp:135:41:135:41 | x |
| tests.cpp:136:37:136:37 | x |
| tests.cpp:137:32:137:32 | x |
| tests.cpp:137:40:137:40 | y |
| tests.cpp:138:47:138:47 | x |
| tests.cpp:138:55:138:55 | y |
| tests.cpp:139:25:139:25 | a |
| tests.cpp:139:33:139:33 | b |
| tests.cpp:139:40:139:40 | c |
| tests.cpp:139:47:139:47 | d |
| tests.cpp:140:20:140:20 | a |
| tests.cpp:140:28:140:28 | b |
| tests.cpp:141:34:141:34 | a |
| tests.cpp:141:41:141:41 | b |
| tests.cpp:141:48:141:48 | c |
| tests.cpp:146:38:146:39 | mc |
| tests.cpp:147:47:147:48 | mc |
| tests.cpp:148:46:148:47 | mc |
| tests.cpp:149:38:149:38 | x |
| tests.cpp:150:47:150:47 | x |
| tests.cpp:151:46:151:46 | x |
| tests.cpp:153:13:153:30 | madFieldToFieldVar |
| tests.cpp:154:13:154:38 | madFieldToIndirectFieldVar |
| tests.cpp:155:14:155:39 | madIndirectFieldToFieldVar |
| tests.cpp:157:6:157:19 | test_summaries |
| tests.cpp:160:6:160:6 | a |
| tests.cpp:160:9:160:9 | b |
| tests.cpp:160:12:160:12 | c |
| tests.cpp:160:15:160:15 | d |
| tests.cpp:160:18:160:18 | e |
| tests.cpp:161:7:161:11 | a_ptr |
| tests.cpp:204:14:204:16 | mc1 |
| tests.cpp:204:19:204:21 | mc2 |
| tests.cpp:223:15:223:18 | rtn1 |
| tests.cpp:226:14:226:17 | rtn2 |
| tests.cpp:227:7:227:14 | rtn2_ptr |
| tests.cpp:253:7:253:7 | operator= |
| tests.cpp:253:7:253:7 | operator= |
| tests.cpp:253:7:253:13 | MyClass |
| tests.cpp:256:6:256:26 | memberRemoteMadSource |
| tests.cpp:257:7:257:39 | memberRemoteMadSourceIndirectArg0 |
| tests.cpp:257:46:257:46 | x |
| tests.cpp:258:6:258:29 | memberRemoteMadSourceVar |
| tests.cpp:259:7:259:21 | qualifierSource |
| tests.cpp:260:7:260:26 | qualifierFieldSource |
| tests.cpp:263:7:263:23 | memberMadSinkArg0 |
| tests.cpp:263:29:263:29 | x |
| tests.cpp:264:6:264:21 | memberMadSinkVar |
| tests.cpp:265:7:265:19 | qualifierSink |
| tests.cpp:266:7:266:23 | qualifierArg0Sink |
| tests.cpp:266:29:266:29 | x |
| tests.cpp:267:7:267:24 | qualifierFieldSink |
| tests.cpp:270:25:270:25 | x |
| tests.cpp:272:6:272:16 | notASummary |
| tests.cpp:273:26:273:26 | x |
| tests.cpp:276:6:276:8 | val |
| tests.cpp:279:7:279:7 | MyDerivedClass |
| tests.cpp:279:7:279:7 | operator= |
| tests.cpp:279:7:279:7 | operator= |
| tests.cpp:279:7:279:20 | MyDerivedClass |
| tests.cpp:281:6:281:28 | subtypeRemoteMadSource1 |
| tests.cpp:282:6:282:21 | subtypeNonSource |
| tests.cpp:283:6:283:28 | subtypeRemoteMadSource2 |
| tests.cpp:286:9:286:15 | source2 |
| tests.cpp:287:6:287:9 | sink |
| tests.cpp:287:19:287:20 | mc |
| tests.cpp:290:8:290:8 | operator= |
| tests.cpp:290:8:290:8 | operator= |
| tests.cpp:290:8:290:14 | MyClass |
| tests.cpp:293:8:293:33 | namespaceMemberMadSinkArg0 |
| tests.cpp:293:39:293:39 | x |
| tests.cpp:294:15:294:46 | namespaceStaticMemberMadSinkArg0 |
| tests.cpp:294:52:294:52 | x |
| tests.cpp:295:7:295:31 | namespaceMemberMadSinkVar |
| tests.cpp:296:14:296:44 | namespaceStaticMemberMadSinkVar |
| tests.cpp:303:22:303:28 | source3 |
| tests.cpp:305:6:305:23 | test_class_members |
| tests.cpp:306:10:306:11 | mc |
| tests.cpp:306:14:306:16 | mc2 |
| tests.cpp:306:19:306:21 | mc3 |
| tests.cpp:306:24:306:26 | mc4 |
| tests.cpp:306:29:306:31 | mc5 |
| tests.cpp:306:34:306:36 | mc6 |
| tests.cpp:306:39:306:41 | mc7 |
| tests.cpp:306:44:306:46 | mc8 |
| tests.cpp:306:49:306:51 | mc9 |
| tests.cpp:306:54:306:57 | mc10 |
| tests.cpp:306:60:306:63 | mc11 |
| tests.cpp:307:11:307:13 | ptr |
| tests.cpp:307:17:307:23 | mc4_ptr |
| tests.cpp:308:17:308:19 | mdc |
| tests.cpp:309:23:309:25 | mnc |
| tests.cpp:309:28:309:31 | mnc2 |
| tests.cpp:310:24:310:31 | mnc2_ptr |
| tests.cpp:316:6:316:6 | a |
| tests.cpp:415:8:415:8 | operator= |
| tests.cpp:415:8:415:8 | operator= |
| tests.cpp:415:8:415:14 | intPair |
| tests.cpp:416:6:416:10 | first |
| tests.cpp:417:6:417:11 | second |
| tests.cpp:420:37:420:43 | fun_ptr |
| tests.cpp:421:46:421:52 | fun_ptr |
| tests.cpp:422:34:422:40 | fun_ptr |
| tests.cpp:422:53:422:57 | value |
| tests.cpp:424:5:424:14 | getTainted |
| tests.cpp:425:6:425:13 | useValue |
| tests.cpp:425:19:425:19 | x |
| tests.cpp:427:6:427:27 | test_function_pointers |

View File

@@ -0,0 +1,16 @@
import testModels
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
query predicate summaryCalls(SummaryCall c) {
any()
}
query predicate summarizedCallables(DataFlowCallable c) {
c = TSummarizedCallable(_)
}
query predicate sourceCallables(DataFlowCallable c) {
c = TSourceCallable(_) and
c.getLocation().getFile().toString() != ""
}