Skip to content

Commit 31ae513

Browse files
committed
C++: Implement the subpaths query predicate for cpp/invalid-pointer-deref
1 parent d8c0054 commit 31ae513

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,16 @@ query predicate edges(MergedPathNode node1, MergedPathNode node2) {
345345
joinOn2(node1.asPathNode3(), node2.asSinkNode(), _)
346346
}
347347

348+
query predicate subpaths(
349+
MergedPathNode arg, MergedPathNode par, MergedPathNode ret, MergedPathNode out
350+
) {
351+
AllocToInvalidPointerFlow::PathGraph1::subpaths(arg.asPathNode1(), par.asPathNode1(),
352+
ret.asPathNode1(), out.asPathNode1())
353+
or
354+
InvalidPointerToDerefFlow::PathGraph::subpaths(arg.asPathNode3(), par.asPathNode3(),
355+
ret.asPathNode3(), out.asPathNode3())
356+
}
357+
348358
/**
349359
* Holds if `p1` is a sink of `AllocToInvalidPointerConf` and `p2` is a source
350360
* of `InvalidPointerToDerefConf`, and they are connected through `pai`.

0 commit comments

Comments
 (0)