Skip to content

Commit d496503

Browse files
committed
Data flow: Restrict the size of getApNil()
1 parent 492add1 commit d496503

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ private module Stage2 {
765765
bindingset[result, ap]
766766
private ApApprox getApprox(Ap ap) { any() }
767767

768-
private ApNil getApNil(Node node) { any() }
768+
private Ap getApNil(Node node) { PrevStage::revFlow(node, _) and result instanceof ApNil }
769769

770770
bindingset[tc, tail]
771771
private Ap apCons(TypedContent tc, Ap tail) { result = true and exists(tc) and exists(tail) }
@@ -1384,7 +1384,9 @@ private module Stage3 {
13841384

13851385
private ApApprox getApprox(Ap ap) { result = ap.toBoolNonEmpty() }
13861386

1387-
private ApNil getApNil(Node node) { result = TFrontNil(getNodeType(node)) }
1387+
private ApNil getApNil(Node node) {
1388+
PrevStage::revFlow(node, _) and result = TFrontNil(getNodeType(node))
1389+
}
13881390

13891391
bindingset[tc, tail]
13901392
private Ap apCons(TypedContent tc, Ap tail) { result.getHead() = tc and exists(tail) }
@@ -2077,7 +2079,9 @@ private module Stage4 {
20772079

20782080
private ApApprox getApprox(Ap ap) { result = ap.getFront() }
20792081

2080-
private ApNil getApNil(Node node) { result = TNil(getNodeType(node)) }
2082+
private ApNil getApNil(Node node) {
2083+
PrevStage::revFlow(node, _) and result = TNil(getNodeType(node))
2084+
}
20812085

20822086
bindingset[tc, tail]
20832087
private Ap apCons(TypedContent tc, Ap tail) { result = push(tc, tail) }

0 commit comments

Comments
 (0)