forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.ql
More file actions
37 lines (26 loc) · 1.41 KB
/
tests.ql
File metadata and controls
37 lines (26 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import javascript
import semmle.javascript.dataflow.internal.FlowSteps as FlowSteps
query predicate argumentPassing(DataFlow::Node invk, DataFlow::Node arg, DataFlow::SourceNode parm) {
exists(Function f | FlowSteps::argumentPassing(invk, arg, f, parm))
}
query predicate basicBlock(DataFlow::Node node, BasicBlock bb) { node.getBasicBlock() = bb }
query predicate enclosingExpr(DataFlow::Node node, Expr enclosingExpr) {
enclosingExpr = node.getEnclosingExpr()
}
query predicate flowStep(DataFlow::Node pred, DataFlow::Node nd) { nd.getAPredecessor() = pred }
query predicate getImmediatePredecessor(DataFlow::Node pred, DataFlow::Node nd) {
nd.getImmediatePredecessor() = pred
}
query predicate getIntValue(DataFlow::Node node, int val) { node.getIntValue() = val }
query predicate incomplete(DataFlow::Node dfn, DataFlow::Incompleteness cause) {
dfn.isIncomplete(cause)
}
query predicate noBasicBlock(DataFlow::Node node) { not exists(node.getBasicBlock()) }
query predicate parameters(DataFlow::ParameterNode param) { any() }
query predicate sources(DataFlow::SourceNode src) { any() }
query predicate stress_getAQlClass(string msg) {
// Compile and evaluate `getAQlClass` so we get notified of potential problems with BDD size.
// Avoid outputting its result, however, as the output would constantly need to be updated.
count(DataFlow::Node node, string cls | cls = node.getAQlClass()) >= 42 and
msg = "OK"
}