Skip to content

Commit fa8e721

Browse files
committed
temp2
1 parent 543fa8f commit fa8e721

File tree

5 files changed

+260
-58
lines changed

5 files changed

+260
-58
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,13 +1405,75 @@ private module Cached {
14051405
)
14061406
}
14071407

1408-
private predicate teslastRefBeforeRedefExt(
1409-
DefinitionExtImpl def, ControlFlow::BasicBlock bb, int i, DefinitionExtImpl next
1410-
) {
1411-
lastRefBeforeRedefExt(def, bb, i, next) and
1412-
next.getLocation().getStartLine() = 43
1413-
}
1414-
1408+
// private predicate teslastRefBeforeRedefExt(
1409+
// DefinitionExtImpl def, ControlFlow::BasicBlock bb, int i, DefinitionExtImpl next
1410+
// ) {
1411+
// lastRefBeforeRedefExt(def, bb, i, next) and
1412+
// next.getLocation().getStartLine() = 43
1413+
// }
1414+
// private predicate testadjacentDefReadReachesExclPhiRead(
1415+
// DefinitionExtImpl def, ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2
1416+
// ) {
1417+
// adjacentDefReadReachesExclPhiRead(def, bb1, i1, bb2, i2) and
1418+
// def.getLocation().getStartLine() = 78
1419+
// }
1420+
// private predicate testphilastRefRedefExt(
1421+
// DefinitionExtImpl def, ControlFlow::BasicBlock bb1, int i1, PhiReadNodeImpl phi,
1422+
// ControlFlow::BasicBlock bb2, int i2
1423+
// ) {
1424+
// philastRefRedefExt(def, bb1, i1, phi, bb2, i2)
1425+
// }
1426+
// private predicate testadjacentDefReadExt(
1427+
// PhiReadNodeImpl def, ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2
1428+
// ) {
1429+
// adjacentDefReadExt(def, bb1, i1, bb2, i2)
1430+
// }
1431+
// private predicate testlastRef(Ssa::Definition def, ControlFlow::BasicBlock bb, int i) {
1432+
// lastRef(def, bb, i) and
1433+
// def.getLocation().getStartLine() = 78
1434+
// }
1435+
// private predicate testvarBlockReachesExit(Ssa::Definition def, ControlFlow::BasicBlock bb) {
1436+
// varBlockReachesExit(def, bb) and
1437+
// def.getLocation().getStartLine() = 78
1438+
// }
1439+
// private predicate testvarBlockReaches(
1440+
// Ssa::Definition def, ControlFlow::BasicBlock bb, ControlFlow::BasicBlock bb2
1441+
// ) {
1442+
// varBlockReaches(def, bb, bb2) and
1443+
// def.getLocation().getStartLine() = 78 and
1444+
// bb.getLocation().getStartLine() = 81
1445+
// // def.toString() = "SSA param(x)"
1446+
// }
1447+
// private predicate testvarBlockReachesExt(
1448+
// Ssa::Definition def, ControlFlow::BasicBlock bb, ControlFlow::BasicBlock bb2
1449+
// ) {
1450+
// varBlockReachesExt(def, bb, bb2) and
1451+
// def.getLocation().getStartLine() = 78
1452+
// // def.toString() = "SSA param(x)"
1453+
// }
1454+
// private predicate testvarBlockReachesExt2(
1455+
// PhiReadNodeImpl def, ControlFlow::BasicBlock bb, ControlFlow::BasicBlock bb2
1456+
// ) {
1457+
// varBlockReachesExt(def, bb, bb2)
1458+
// }
1459+
// private predicate testlastSsaRef(
1460+
// Ssa::Definition def, SsaInput::SourceVariable v, SsaInput::BasicBlock bb, int i
1461+
// ) {
1462+
// lastSsaRef(def, v, bb, i) and
1463+
// def.getLocation().getStartLine() = 78
1464+
// }
1465+
// private predicate testlastSsaRefExt(
1466+
// PhiReadNodeImpl def, SsaInput::SourceVariable v, SsaInput::BasicBlock bb, int i
1467+
// ) {
1468+
// lastSsaRefExt(def, v, bb, i)
1469+
// }
1470+
// private predicate testssaDefReachesEndOfBlock(
1471+
// ControlFlow::BasicBlock bb, Ssa::Definition def, SsaInput::SourceVariable v
1472+
// ) {
1473+
// ssaDefReachesEndOfBlock(bb, def, v) and
1474+
// def.getLocation().getStartLine() = 78
1475+
// }
1476+
// private predicate testphiReadStepRev = phiReadStepRev/6;
14151477
cached
14161478
predicate lastReadSameVar(Definition def, ControlFlow::Node cfn) {
14171479
exists(ControlFlow::BasicBlock bb, int i |

csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@
477477
| SSA.cs:37:13:37:31 | SSA def(ssaSink2) | SSA.cs:39:21:39:28 | access to local variable ssaSink2 |
478478
| SSA.cs:37:13:37:31 | SSA def(ssaSink2) | SSA.cs:41:21:41:28 | access to local variable ssaSink2 |
479479
| SSA.cs:37:24:37:31 | access to local variable ssaSink0 | SSA.cs:37:13:37:31 | SSA def(ssaSink2) |
480+
| SSA.cs:37:24:37:31 | access to local variable ssaSink0 | SSA.cs:43:9:43:24 | SSA phi read(ssaSink0) |
480481
| SSA.cs:38:17:38:26 | [post] access to parameter nonTainted | SSA.cs:47:13:47:22 | access to parameter nonTainted |
481482
| SSA.cs:38:17:38:26 | access to parameter nonTainted | SSA.cs:47:13:47:22 | access to parameter nonTainted |
482483
| SSA.cs:39:21:39:28 | [post] access to local variable ssaSink2 | SSA.cs:43:9:43:24 | SSA phi(ssaSink2) |
@@ -495,6 +496,7 @@
495496
| SSA.cs:49:13:49:31 | SSA def(nonSink2) | SSA.cs:51:21:51:28 | access to local variable nonSink2 |
496497
| SSA.cs:49:13:49:31 | SSA def(nonSink2) | SSA.cs:53:21:53:28 | access to local variable nonSink2 |
497498
| SSA.cs:49:24:49:31 | access to local variable nonSink0 | SSA.cs:49:13:49:31 | SSA def(nonSink2) |
499+
| SSA.cs:49:24:49:31 | access to local variable nonSink0 | SSA.cs:63:23:63:30 | access to local variable nonSink0 |
498500
| SSA.cs:50:17:50:26 | [post] access to parameter nonTainted | SSA.cs:89:13:89:22 | access to parameter nonTainted |
499501
| SSA.cs:50:17:50:26 | access to parameter nonTainted | SSA.cs:89:13:89:22 | access to parameter nonTainted |
500502
| SSA.cs:51:21:51:28 | [post] access to local variable nonSink2 | SSA.cs:55:9:55:24 | SSA phi(nonSink2) |
@@ -585,6 +587,7 @@
585587
| SSA.cs:91:13:91:31 | SSA def(ssaSink4) | SSA.cs:93:21:93:28 | access to local variable ssaSink4 |
586588
| SSA.cs:91:13:91:31 | SSA def(ssaSink4) | SSA.cs:95:21:95:28 | access to local variable ssaSink4 |
587589
| SSA.cs:91:24:91:31 | access to local variable ssaSink0 | SSA.cs:91:13:91:31 | SSA def(ssaSink4) |
590+
| SSA.cs:91:24:91:31 | access to local variable ssaSink0 | SSA.cs:97:9:97:32 | SSA phi read(ssaSink0) |
588591
| SSA.cs:92:17:92:26 | [post] access to parameter nonTainted | SSA.cs:102:13:102:22 | access to parameter nonTainted |
589592
| SSA.cs:92:17:92:26 | access to parameter nonTainted | SSA.cs:102:13:102:22 | access to parameter nonTainted |
590593
| SSA.cs:93:21:93:28 | [post] access to local variable ssaSink4 | SSA.cs:97:9:97:32 | SSA phi(ssaSink4) |

csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@
590590
| SSA.cs:37:13:37:31 | SSA def(ssaSink2) | SSA.cs:39:21:39:28 | access to local variable ssaSink2 |
591591
| SSA.cs:37:13:37:31 | SSA def(ssaSink2) | SSA.cs:41:21:41:28 | access to local variable ssaSink2 |
592592
| SSA.cs:37:24:37:31 | access to local variable ssaSink0 | SSA.cs:37:13:37:31 | SSA def(ssaSink2) |
593+
| SSA.cs:37:24:37:31 | access to local variable ssaSink0 | SSA.cs:43:9:43:24 | SSA phi read(ssaSink0) |
593594
| SSA.cs:38:17:38:26 | [post] access to parameter nonTainted | SSA.cs:47:13:47:22 | access to parameter nonTainted |
594595
| SSA.cs:38:17:38:26 | access to parameter nonTainted | SSA.cs:47:13:47:22 | access to parameter nonTainted |
595596
| SSA.cs:38:17:38:33 | access to property Length | SSA.cs:38:17:38:37 | ... > ... |
@@ -610,6 +611,7 @@
610611
| SSA.cs:49:13:49:31 | SSA def(nonSink2) | SSA.cs:51:21:51:28 | access to local variable nonSink2 |
611612
| SSA.cs:49:13:49:31 | SSA def(nonSink2) | SSA.cs:53:21:53:28 | access to local variable nonSink2 |
612613
| SSA.cs:49:24:49:31 | access to local variable nonSink0 | SSA.cs:49:13:49:31 | SSA def(nonSink2) |
614+
| SSA.cs:49:24:49:31 | access to local variable nonSink0 | SSA.cs:63:23:63:30 | access to local variable nonSink0 |
613615
| SSA.cs:50:17:50:26 | [post] access to parameter nonTainted | SSA.cs:89:13:89:22 | access to parameter nonTainted |
614616
| SSA.cs:50:17:50:26 | access to parameter nonTainted | SSA.cs:89:13:89:22 | access to parameter nonTainted |
615617
| SSA.cs:50:17:50:33 | access to property Length | SSA.cs:50:17:50:37 | ... > ... |
@@ -702,6 +704,7 @@
702704
| SSA.cs:91:13:91:31 | SSA def(ssaSink4) | SSA.cs:93:21:93:28 | access to local variable ssaSink4 |
703705
| SSA.cs:91:13:91:31 | SSA def(ssaSink4) | SSA.cs:95:21:95:28 | access to local variable ssaSink4 |
704706
| SSA.cs:91:24:91:31 | access to local variable ssaSink0 | SSA.cs:91:13:91:31 | SSA def(ssaSink4) |
707+
| SSA.cs:91:24:91:31 | access to local variable ssaSink0 | SSA.cs:97:9:97:32 | SSA phi read(ssaSink0) |
705708
| SSA.cs:92:17:92:26 | [post] access to parameter nonTainted | SSA.cs:102:13:102:22 | access to parameter nonTainted |
706709
| SSA.cs:92:17:92:26 | access to parameter nonTainted | SSA.cs:102:13:102:22 | access to parameter nonTainted |
707710
| SSA.cs:92:17:92:33 | access to property Length | SSA.cs:92:17:92:37 | ... > ... |

csharp/ql/test/library-tests/dataflow/ssa/ReadAdjacentRead.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
| DefUse.cs:97:13:97:14 | x5 | DefUse.cs:98:16:98:17 | access to local variable x5 | DefUse.cs:104:9:104:10 | access to local variable x5 |
1919
| DefUse.cs:97:13:97:14 | x5 | DefUse.cs:100:17:100:18 | access to local variable x5 | DefUse.cs:101:18:101:19 | access to local variable x5 |
2020
| DefUse.cs:122:16:122:21 | Field2 | DefUse.cs:64:13:64:18 | access to field Field2 | DefUse.cs:80:37:80:42 | access to field Field2 |
21+
| DefUse.cs:122:16:122:21 | Field2 | DefUse.cs:80:37:80:42 | access to field Field2 | DefUse.cs:80:37:80:42 | access to field Field2 |
2122
| DefUse.cs:144:22:144:22 | x | DefUse.cs:146:17:146:17 | access to local variable x | DefUse.cs:147:17:147:17 | access to local variable x |
2223
| DefUse.cs:152:9:152:14 | Field4 | DefUse.cs:156:13:156:18 | access to field Field4 | DefUse.cs:157:13:157:18 | access to field Field4 |
2324
| DefUse.cs:152:9:152:14 | Field4 | DefUse.cs:162:13:162:18 | access to field Field4 | DefUse.cs:163:13:163:18 | access to field Field4 |

0 commit comments

Comments
 (0)