diff --git a/.github/workflows/qhelp-pr-preview.yml b/.github/workflows/qhelp-pr-preview.yml
index 8aba0a0c5e3..a44ef5ad48d 100644
--- a/.github/workflows/qhelp-pr-preview.yml
+++ b/.github/workflows/qhelp-pr-preview.yml
@@ -27,7 +27,7 @@ on:
- main
- "rc/*"
paths:
- - "ruby/**/*.qhelp"
+ - "**/*.qhelp"
jobs:
qhelp:
@@ -52,7 +52,7 @@ jobs:
id: changes
run: |
(git diff -z --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep -z '.qhelp$' | grep -z -v '.inc.qhelp';
- git diff -z --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep -z '.inc.qhelp$' | xargs --null -rn1 basename | xargs --null -rn1 git grep -z -l) |
+ git diff -z --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep -z '.inc.qhelp$' | xargs --null -rn1 basename -z | xargs --null -rn1 git grep -z -l) |
grep -z '.qhelp$' | grep -z -v '^-' | sort -z -u > "${RUNNER_TEMP}/paths.txt"
- name: QHelp preview
diff --git a/.github/workflows/swift-autobuilder.yml b/.github/workflows/swift-autobuilder.yml
new file mode 100644
index 00000000000..d3afa9f476b
--- /dev/null
+++ b/.github/workflows/swift-autobuilder.yml
@@ -0,0 +1,25 @@
+name: "Swift: Build and test Xcode autobuilder"
+
+on:
+ pull_request:
+ paths:
+ - "swift/xcode-autobuilder/**"
+ - "misc/bazel/**"
+ - "*.bazel*"
+ - .github/workflows/swift-autobuilder.yml
+ branches:
+ - main
+
+jobs:
+ autobuilder:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: bazelbuild/setup-bazelisk@v2
+ - uses: actions/setup-python@v3
+ - name: Build the Xcode autobuilder
+ run: |
+ bazel build //swift/xcode-autobuilder
+ - name: Test the Xcode autobuilder
+ run: |
+ bazel test //swift/xcode-autobuilder/tests
diff --git a/config/identical-files.json b/config/identical-files.json
index de7b75c5d48..832fac7741c 100644
--- a/config/identical-files.json
+++ b/config/identical-files.json
@@ -33,8 +33,9 @@
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
- "ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForLibraries.qll",
+ "ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForRegExp.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForHttpClientLibraries.qll",
+ "ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForPathname.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImpl.qll"
],
"DataFlow Java/C++/C#/Python Common": [
@@ -69,7 +70,6 @@
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking3/TaintTrackingImpl.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking4/TaintTrackingImpl.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
- "ruby/ql/lib/codeql/ruby/dataflow/internal/tainttrackingforlibraries/TaintTrackingImpl.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
],
"DataFlow Java/C++/C#/Python Consistency checks": [
diff --git a/cpp/ql/lib/CHANGELOG.md b/cpp/ql/lib/CHANGELOG.md
index f1dfa53f9ba..5ccbbd8592c 100644
--- a/cpp/ql/lib/CHANGELOG.md
+++ b/cpp/ql/lib/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.4.1
+
+No user-facing changes.
+
## 0.4.0
### Deprecated APIs
diff --git a/cpp/ql/lib/change-notes/released/0.4.1.md b/cpp/ql/lib/change-notes/released/0.4.1.md
new file mode 100644
index 00000000000..0d865d0571e
--- /dev/null
+++ b/cpp/ql/lib/change-notes/released/0.4.1.md
@@ -0,0 +1,3 @@
+## 0.4.1
+
+No user-facing changes.
diff --git a/cpp/ql/lib/codeql-pack.release.yml b/cpp/ql/lib/codeql-pack.release.yml
index 458bfbeccff..89fa3a87180 100644
--- a/cpp/ql/lib/codeql-pack.release.yml
+++ b/cpp/ql/lib/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 0.4.0
+lastReleaseVersion: 0.4.1
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll b/cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll
index 662db9e9721..6b74d61feea 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll
@@ -133,6 +133,18 @@ module ProductFlow {
this.isAdditionalFlowStep2(node1, node2)
}
+ /**
+ * Holds if data flow into `node` is prohibited in the first projection of the product
+ * dataflow graph.
+ */
+ predicate isBarrierIn1(DataFlow::Node node) { none() }
+
+ /**
+ * Holds if data flow into `node` is prohibited in the second projection of the product
+ * dataflow graph.
+ */
+ predicate isBarrierIn2(DataFlow::Node node) { none() }
+
predicate hasFlowPath(
DataFlow::PathNode source1, DataFlow2::PathNode source2, DataFlow::PathNode sink1,
DataFlow2::PathNode sink2
@@ -169,6 +181,10 @@ module ProductFlow {
) {
exists(Configuration conf | conf.isAdditionalFlowStep1(node1, state1, node2, state2))
}
+
+ override predicate isBarrierIn(DataFlow::Node node) {
+ exists(Configuration conf | conf.isBarrierIn1(node))
+ }
}
class Conf2 extends DataFlow2::Configuration {
@@ -202,9 +218,14 @@ module ProductFlow {
) {
exists(Configuration conf | conf.isAdditionalFlowStep2(node1, state1, node2, state2))
}
+
+ override predicate isBarrierIn(DataFlow::Node node) {
+ exists(Configuration conf | conf.isBarrierIn2(node))
+ }
}
}
+ pragma[nomagic]
private predicate reachableInterprocEntry(
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
DataFlow::PathNode node1, DataFlow2::PathNode node2
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
index d6b2d455dd2..69e08a9a5d2 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
@@ -137,7 +137,7 @@ private newtype TReturnKind =
exists(IndirectReturnNode return, ReturnIndirectionInstruction returnInd |
returnInd.hasIndex(argumentIndex) and
return.getAddressOperand() = returnInd.getSourceAddressOperand() and
- indirectionIndex = return.getIndirectionIndex() - 1 // We subtract one because the return loads the value.
+ indirectionIndex = return.getIndirectionIndex()
)
}
@@ -197,7 +197,7 @@ class ReturnIndirectionNode extends IndirectReturnNode, ReturnNode {
exists(int argumentIndex, ReturnIndirectionInstruction returnInd |
returnInd.hasIndex(argumentIndex) and
this.getAddressOperand() = returnInd.getSourceAddressOperand() and
- result = TIndirectReturnKind(argumentIndex, this.getIndirectionIndex() - 1) and
+ result = TIndirectReturnKind(argumentIndex, this.getIndirectionIndex()) and
hasNonInitializeParameterDef(returnInd.getIRVariable())
)
or
@@ -241,7 +241,7 @@ private Instruction getANonConversionUse(Operand operand) {
/**
* Gets the operand that represents the first use of the value of `call` following
- * a sequnce of conversion-like instructions.
+ * a sequence of conversion-like instructions.
*/
predicate operandForfullyConvertedCall(Operand operand, CallInstruction call) {
exists(getANonConversionUse(operand)) and
@@ -254,7 +254,7 @@ predicate operandForfullyConvertedCall(Operand operand, CallInstruction call) {
/**
* Gets the instruction that represents the first use of the value of `call` following
- * a sequnce of conversion-like instructions.
+ * a sequence of conversion-like instructions.
*
* This predicate only holds if there is no suitable operand (i.e., no operand of a non-
* conversion instruction) to use to represent the value of `call` after conversions.
@@ -365,7 +365,7 @@ predicate jumpStep(Node n1, Node n2) {
predicate storeStep(Node node1, Content c, PostFieldUpdateNode node2) {
exists(int indirectionIndex1, int numberOfLoads, StoreInstruction store |
nodeHasInstruction(node1, store, pragma[only_bind_into](indirectionIndex1)) and
- node2.getIndirectionIndex() = 0 and
+ node2.getIndirectionIndex() = 1 and
numberOfLoadsFromOperand(node2.getFieldAddress(), store.getDestinationAddressOperand(),
numberOfLoads)
|
@@ -465,20 +465,20 @@ predicate clearsContent(Node n, Content c) {
predicate expectsContent(Node n, ContentSet c) { none() }
/** Gets the type of `n` used for type pruning. */
-IRType getNodeType(Node n) {
+DataFlowType getNodeType(Node n) {
suppressUnusedNode(n) and
- result instanceof IRVoidType // stub implementation
+ result instanceof VoidType // stub implementation
}
/** Gets a string representation of a type returned by `getNodeType`. */
-string ppReprType(IRType t) { none() } // stub implementation
+string ppReprType(DataFlowType t) { none() } // stub implementation
/**
* Holds if `t1` and `t2` are compatible, that is, whether data can flow from
* a node of type `t1` to a node of type `t2`.
*/
pragma[inline]
-predicate compatibleTypes(IRType t1, IRType t2) {
+predicate compatibleTypes(DataFlowType t1, DataFlowType t2) {
any() // stub implementation
}
@@ -502,7 +502,7 @@ class DataFlowCallable = Cpp::Declaration;
class DataFlowExpr = Expr;
-class DataFlowType = IRType;
+class DataFlowType = Type;
/** A function call relevant for data flow. */
class DataFlowCall extends CallInstruction {
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
index 08d5f270e5a..dc462fecc94 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
@@ -38,13 +38,12 @@ private module Cached {
TVariableNode(Variable var) or
TPostFieldUpdateNode(FieldAddress operand, int indirectionIndex) {
indirectionIndex =
- [0 .. Ssa::countIndirectionsForCppType(operand.getObjectAddress().getResultLanguageType()) -
- 1]
+ [1 .. Ssa::countIndirectionsForCppType(operand.getObjectAddress().getResultLanguageType())]
} or
TSsaPhiNode(Ssa::PhiNode phi) or
TIndirectArgumentOutNode(ArgumentOperand operand, int indirectionIndex) {
Ssa::isModifiableByCall(operand) and
- indirectionIndex = [0 .. Ssa::countIndirectionsForCppType(operand.getLanguageType()) - 1]
+ indirectionIndex = [1 .. Ssa::countIndirectionsForCppType(operand.getLanguageType())]
} or
TIndirectOperand(Operand op, int indirectionIndex) {
Ssa::hasIndirectOperand(op, indirectionIndex)
@@ -113,7 +112,7 @@ class Node extends TIRDataFlowNode {
Declaration getFunction() { none() } // overridden in subclasses
/** Gets the type of this node. */
- IRType getType() { none() } // overridden in subclasses
+ DataFlowType getType() { none() } // overridden in subclasses
/** Gets the instruction corresponding to this node, if any. */
Instruction asInstruction() { result = this.(InstructionNode).getInstruction() }
@@ -230,7 +229,13 @@ class Node extends TIRDataFlowNode {
Expr asIndirectArgument() { result = this.asIndirectArgument(_) }
/** Gets the positional parameter corresponding to this node, if any. */
- Parameter asParameter() { result = asParameter(0) }
+ Parameter asParameter() { result = this.asParameter(0) }
+
+ /**
+ * Gets the uninitialized local variable corresponding to this node, if
+ * any.
+ */
+ LocalVariable asUninitialized() { result = this.(UninitializedNode).getLocalVariable() }
/**
* Gets the positional parameter corresponding to the node that represents
@@ -273,7 +278,7 @@ class Node extends TIRDataFlowNode {
/**
* Gets an upper bound on the type of this node.
*/
- IRType getTypeBound() { result = this.getType() }
+ DataFlowType getTypeBound() { result = this.getType() }
/** Gets the location of this element. */
cached
@@ -322,7 +327,7 @@ class InstructionNode extends Node, TInstructionNode {
override Declaration getFunction() { result = instr.getEnclosingFunction() }
- override IRType getType() { result = instr.getResultIRType() }
+ override DataFlowType getType() { result = instr.getResultType() }
final override Location getLocationImpl() { result = instr.getLocation() }
@@ -348,13 +353,32 @@ class OperandNode extends Node, TOperandNode {
override Declaration getFunction() { result = op.getUse().getEnclosingFunction() }
- override IRType getType() { result = op.getIRType() }
+ override DataFlowType getType() { result = op.getType() }
final override Location getLocationImpl() { result = op.getLocation() }
override string toStringImpl() { result = this.getOperand().toString() }
}
+/**
+ * Returns `t`, but stripped of the `n` outermost pointers, references, etc.
+ *
+ * For example, `stripPointers(int*&, 2)` is `int` and `stripPointers(int*, 0)` is `int*`.
+ */
+private Type stripPointers(Type t, int n) {
+ result = t and n = 0
+ or
+ result = stripPointers(t.(PointerType).getBaseType(), n - 1)
+ or
+ result = stripPointers(t.(ArrayType).getBaseType(), n - 1)
+ or
+ result = stripPointers(t.(ReferenceType).getBaseType(), n - 1)
+ or
+ result = stripPointers(t.(PointerToMemberType).getBaseType(), n - 1)
+ or
+ result = stripPointers(t.(FunctionPointerIshType).getBaseType(), n - 1)
+}
+
/**
* INTERNAL: do not use.
*
@@ -370,8 +394,6 @@ class PostFieldUpdateNode extends TPostFieldUpdateNode, PartialDefinitionNode {
override Declaration getEnclosingCallable() { result = this.getFunction() }
- override IRType getType() { result = fieldAddress.getIRType() }
-
FieldAddress getFieldAddress() { result = fieldAddress }
Field getUpdatedField() { result = fieldAddress.getField() }
@@ -379,10 +401,8 @@ class PostFieldUpdateNode extends TPostFieldUpdateNode, PartialDefinitionNode {
int getIndirectionIndex() { result = indirectionIndex }
override Node getPreUpdateNode() {
- // + 1 because we're storing into an lvalue, and the original node should be the rvalue of
- // the same address.
hasOperandAndIndex(result, pragma[only_bind_into](fieldAddress).getObjectAddressOperand(),
- indirectionIndex + 1)
+ indirectionIndex)
}
override Expr getDefinedExpr() {
@@ -411,7 +431,7 @@ class SsaPhiNode extends Node, TSsaPhiNode {
override Declaration getFunction() { result = phi.getBasicBlock().getEnclosingFunction() }
- override IRType getType() { result instanceof IRVoidType }
+ override DataFlowType getType() { result = this.getAnInput().getType() }
final override Location getLocationImpl() { result = phi.getBasicBlock().getLocation() }
@@ -454,8 +474,6 @@ class SideEffectOperandNode extends Node, IndirectOperand {
override Function getFunction() { result = call.getEnclosingFunction() }
- override IRType getType() { result instanceof IRVoidType }
-
Expr getArgument() { result = call.getArgument(argumentIndex).getUnconvertedResultExpression() }
}
@@ -478,8 +496,6 @@ class IndirectParameterNode extends Node, IndirectInstruction {
override Function getFunction() { result = this.getInstruction().getEnclosingFunction() }
- override IRType getType() { result instanceof IRVoidType }
-
override string toStringImpl() {
result = this.getParameter().toString() + " indirection"
or
@@ -504,8 +520,6 @@ class IndirectReturnNode extends IndirectOperand {
Operand getAddressOperand() { result = operand }
override Declaration getEnclosingCallable() { result = this.getFunction() }
-
- override IRType getType() { result instanceof IRVoidType }
}
/**
@@ -536,9 +550,7 @@ class IndirectArgumentOutNode extends Node, TIndirectArgumentOutNode, PostUpdate
override Function getFunction() { result = this.getCallInstruction().getEnclosingFunction() }
- override IRType getType() { result instanceof IRVoidType }
-
- override Node getPreUpdateNode() { hasOperandAndIndex(result, operand, indirectionIndex + 1) }
+ override Node getPreUpdateNode() { hasOperandAndIndex(result, operand, indirectionIndex) }
override string toStringImpl() {
// This string should be unique enough to be helpful but common enough to
@@ -594,6 +606,38 @@ class IndirectReturnOutNode extends Node {
int getIndirectionIndex() { result = indirectionIndex }
}
+private PointerType getGLValueType(Type t, int indirectionIndex) {
+ result.getBaseType() = stripPointers(t, indirectionIndex - 1)
+}
+
+bindingset[isGLValue]
+private DataFlowType getTypeImpl(Type t, int indirectionIndex, boolean isGLValue) {
+ if isGLValue = true
+ then
+ result = getGLValueType(t, indirectionIndex)
+ or
+ // Ideally, the above case would cover all glvalue cases. However, consider the case where
+ // the database consists only of:
+ // ```
+ // void test() {
+ // int* x;
+ // x = nullptr;
+ // }
+ // ```
+ // and we want to compute the type of `*x` in the assignment `x = nullptr`. Here, `x` is an lvalue
+ // of type int* (which morally is an int**). So when we call `getTypeImpl` it will be with the
+ // parameters:
+ // - t = int*
+ // - indirectionIndex = 1 (when we want to model the dataflow node corresponding to *x)
+ // - isGLValue = true
+ // In this case, `getTypeImpl(t, indirectionIndex, isGLValue)` should give back `int**`. In this
+ // case, however, `int**` does not exist in the database. So instead we return int* (which is
+ // wrong, but at least we have a type).
+ not exists(getGLValueType(t, indirectionIndex)) and
+ result = stripPointers(t, indirectionIndex - 1)
+ else result = stripPointers(t, indirectionIndex)
+}
+
/**
* INTERNAL: Do not use.
*
@@ -615,7 +659,11 @@ class IndirectOperand extends Node, TIndirectOperand {
override Declaration getEnclosingCallable() { result = this.getFunction() }
- override IRType getType() { result = this.getOperand().getIRType() }
+ override DataFlowType getType() {
+ exists(boolean isGLValue | if operand.isGLValue() then isGLValue = true else isGLValue = false |
+ result = getTypeImpl(operand.getType().getUnspecifiedType(), indirectionIndex, isGLValue)
+ )
+ }
final override Location getLocationImpl() { result = this.getOperand().getLocation() }
@@ -624,6 +672,25 @@ class IndirectOperand extends Node, TIndirectOperand {
}
}
+/**
+ * The value of an uninitialized local variable, viewed as a node in a data
+ * flow graph.
+ */
+class UninitializedNode extends Node {
+ LocalVariable v;
+
+ UninitializedNode() {
+ exists(Ssa::Def def |
+ def.getDefiningInstruction() instanceof UninitializedInstruction and
+ Ssa::nodeToDefOrUse(this, def) and
+ v = def.getSourceVariable().getBaseVariable().(Ssa::BaseIRVariable).getIRVariable().getAst()
+ )
+ }
+
+ /** Gets the uninitialized local variable corresponding to this node. */
+ LocalVariable getLocalVariable() { result = v }
+}
+
/**
* INTERNAL: Do not use.
*
@@ -645,7 +712,11 @@ class IndirectInstruction extends Node, TIndirectInstruction {
override Declaration getEnclosingCallable() { result = this.getFunction() }
- override IRType getType() { result = this.getInstruction().getResultIRType() }
+ override DataFlowType getType() {
+ exists(boolean isGLValue | if instr.isGLValue() then isGLValue = true else isGLValue = false |
+ result = getTypeImpl(instr.getResultType().getUnspecifiedType(), indirectionIndex, isGLValue)
+ )
+ }
final override Location getLocationImpl() { result = this.getInstruction().getLocation() }
@@ -675,7 +746,7 @@ predicate exprNodeShouldBeOperand(Node node, Expr e) {
/**
* Holds if `load` is a `LoadInstruction` that is the result of evaluating `e`
- * and `node` is an `IndirctOperandNode` that should map `node.asExpr()` to `e`.
+ * and `node` is an `IndirectOperandNode` that should map `node.asExpr()` to `e`.
*
* We map `e` to `node.asExpr()` when `node` semantically represents the
* same value as `load`. A subsequent flow step will flow `node` to
@@ -859,6 +930,8 @@ abstract class PostUpdateNode extends Node {
* Gets the node before the state update.
*/
abstract Node getPreUpdateNode();
+
+ final override DataFlowType getType() { result = this.getPreUpdateNode().getType() }
}
/**
@@ -922,7 +995,7 @@ class VariableNode extends Node, TVariableNode {
result = v
}
- override IRType getType() { result.getCanonicalLanguageType().hasUnspecifiedType(v.getType(), _) }
+ override DataFlowType getType() { result = v.getType() }
final override Location getLocationImpl() { result = v.getLocation() }
@@ -1075,7 +1148,7 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
store.getDestinationAddressOperand() = address
)
or
- Ssa::outNodeHasAddressAndIndex(nodeFrom, address, indirectionIndex - 1)
+ Ssa::outNodeHasAddressAndIndex(nodeFrom, address, indirectionIndex)
)
}
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ModelUtil.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ModelUtil.qll
index c302c6ef878..27edf7ce02c 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ModelUtil.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ModelUtil.qll
@@ -41,7 +41,7 @@ Node callOutput(CallInstruction call, FunctionOutput output) {
// The side effect of a call on the value pointed to by an argument or qualifier
exists(int index, int indirectionIndex |
result.(IndirectArgumentOutNode).getArgumentIndex() = index and
- result.(IndirectArgumentOutNode).getIndirectionIndex() + 1 = indirectionIndex and
+ result.(IndirectArgumentOutNode).getIndirectionIndex() = indirectionIndex and
result.(IndirectArgumentOutNode).getCallInstruction() = call and
output.isParameterDerefOrQualifierObject(index, indirectionIndex)
)
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll
index 7359656e5a4..a14b2b00651 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll
@@ -100,7 +100,7 @@ private string getNodeProperty(DataFlow::Node node, string key) {
or
// Is there partial flow from a source to this node?
// This property will only be emitted if partial flow is enabled by overriding
- // `DataFlow::Configration::explorationLimit()`.
+ // `DataFlow::Configuration::explorationLimit()`.
key = "pflow" and
result =
strictconcat(DataFlow::PartialPathNode sourceNode, DataFlow::PartialPathNode destNode, int dist,
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/SsaInternalsCommon.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/SsaInternalsCommon.qll
index 36ab036c4e5..2e0a20fcfdc 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/SsaInternalsCommon.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/SsaInternalsCommon.qll
@@ -11,7 +11,9 @@ private import DataFlowUtil
* corresponding `(Indirect)OperandNode`.
*/
predicate ignoreOperand(Operand operand) {
- operand = any(Instruction instr | ignoreInstruction(instr)).getAnOperand()
+ operand = any(Instruction instr | ignoreInstruction(instr)).getAnOperand() or
+ operand = any(Instruction instr | ignoreInstruction(instr)).getAUse() or
+ operand instanceof MemoryOperand
}
/**
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ssa0/SsaInternals.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ssa0/SsaInternals.qll
index 3a89f1d170f..06c4a7f751c 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ssa0/SsaInternals.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/ssa0/SsaInternals.qll
@@ -36,7 +36,7 @@ private module SourceVariables {
override string toString() { result = var.toString() }
- override DataFlowType getType() { result = var.getIRType() }
+ override DataFlowType getType() { result = var.getType() }
}
class BaseCallVariable extends BaseSourceVariable, TBaseCallVariable {
@@ -48,7 +48,7 @@ private module SourceVariables {
override string toString() { result = call.toString() }
- override DataFlowType getType() { result = call.getResultIRType() }
+ override DataFlowType getType() { result = call.getResultType() }
}
private newtype TSourceVariable =
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll
index 10944b55fbc..27c3083fecc 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll
@@ -71,7 +71,7 @@ abstract class CustomSignDef extends SignDef {
* Concrete implementations extend one of the following subclasses:
* - `ConstantSignExpr`, for expressions with a compile-time constant value.
* - `FlowSignExpr`, for expressions whose sign can be computed from the signs of their operands.
- * - `CustomsignExpr`, for expressions shose sign can be computed by a language-specific
+ * - `CustomsignExpr`, for expressions whose sign can be computed by a language-specific
* implementation.
*
* If the same expression matches more than one of the above subclasses, the sign is computed as
diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll
index e44281af85b..0f482790d4d 100644
--- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll
+++ b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll
@@ -11,7 +11,7 @@ private import experimental.semmle.code.cpp.semantic.Semantic
predicate ignoreTypeRestrictions(SemExpr e) { none() }
/**
- * Workaround to track the sign of cetain expressions even if the type of the expression is not
+ * Workaround to track the sign of certain expressions even if the type of the expression is not
* numeric.
*/
predicate trackUnknownNonNumericExpr(SemExpr e) { none() }
diff --git a/cpp/ql/lib/qlpack.yml b/cpp/ql/lib/qlpack.yml
index cb70ba272d3..fade2cc7c96 100644
--- a/cpp/ql/lib/qlpack.yml
+++ b/cpp/ql/lib/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/cpp-all
-version: 0.4.1-dev
+version: 0.4.2-dev
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp
diff --git a/cpp/ql/lib/semmle/code/cpp/Linkage.qll b/cpp/ql/lib/semmle/code/cpp/Linkage.qll
index 766ddd188c1..e604ce06dee 100644
--- a/cpp/ql/lib/semmle/code/cpp/Linkage.qll
+++ b/cpp/ql/lib/semmle/code/cpp/Linkage.qll
@@ -1,5 +1,5 @@
/**
- * Proivdes the `LinkTarget` class representing linker invocations during the build process.
+ * Provides the `LinkTarget` class representing linker invocations during the build process.
*/
import semmle.code.cpp.Class
diff --git a/cpp/ql/lib/semmle/code/cpp/Variable.qll b/cpp/ql/lib/semmle/code/cpp/Variable.qll
index b0e0647d24b..c82f3689c85 100644
--- a/cpp/ql/lib/semmle/code/cpp/Variable.qll
+++ b/cpp/ql/lib/semmle/code/cpp/Variable.qll
@@ -144,7 +144,7 @@ class Variable extends Declaration, @variable {
* `Variable.getInitializer()` to get the variable's initializer,
* or use `Variable.getAnAssignedValue()` to get an expression that
* is the right-hand side of an assignment or an initialization of
- * the varible.
+ * the variable.
*/
Assignment getAnAssignment() { result.getLValue() = this.getAnAccess() }
@@ -173,7 +173,7 @@ class Variable extends Declaration, @variable {
}
/**
- * Holds if this variable is declated as part of a structured binding
+ * Holds if this variable is declared as part of a structured binding
* declaration. For example, `x` in `auto [x, y] = ...`.
*/
predicate isStructuredBinding() { is_structured_binding(underlyingElement(this)) }
diff --git a/cpp/ql/lib/semmle/code/cpp/commons/Printf.qll b/cpp/ql/lib/semmle/code/cpp/commons/Printf.qll
index b093a73e429..32872eea915 100644
--- a/cpp/ql/lib/semmle/code/cpp/commons/Printf.qll
+++ b/cpp/ql/lib/semmle/code/cpp/commons/Printf.qll
@@ -76,7 +76,7 @@ class TypeBoundsAnalysis extends BufferWriteEstimationReason, TTypeBoundsAnalysi
/**
* The estimation comes from non trivial bounds found via actual flow analysis,
- * but a widening aproximation might have been used for variables in loops.
+ * but a widening approximation might have been used for variables in loops.
* For example
* ```
* for (int i = 0; i < 10; ++i) {
@@ -141,7 +141,7 @@ class AttributeFormattingFunction extends FormattingFunction {
* - `""` is a `vprintf` variant, `outputParamIndex` is `-1`.
* - `"f"` is a `vfprintf` variant, `outputParamIndex` indicates the output stream parameter.
* - `"s"` is a `vsprintf` variant, `outputParamIndex` indicates the output buffer parameter.
- * - `"?"` if the type cannot be deteremined. `outputParamIndex` is `-1`.
+ * - `"?"` if the type cannot be determined. `outputParamIndex` is `-1`.
*/
predicate primitiveVariadicFormatter(
TopLevelFunction f, string type, int formatParamIndex, int outputParamIndex
@@ -198,7 +198,7 @@ private predicate callsVariadicFormatter(
* - `""` is a `vprintf` variant, `outputParamIndex` is `-1`.
* - `"f"` is a `vfprintf` variant, `outputParamIndex` indicates the output stream parameter.
* - `"s"` is a `vsprintf` variant, `outputParamIndex` indicates the output buffer parameter.
- * - `"?"` if the type cannot be deteremined. `outputParamIndex` is `-1`.
+ * - `"?"` if the type cannot be determined. `outputParamIndex` is `-1`.
*/
predicate variadicFormatter(Function f, string type, int formatParamIndex, int outputParamIndex) {
primitiveVariadicFormatter(f, type, formatParamIndex, outputParamIndex)
diff --git a/cpp/ql/lib/semmle/code/cpp/controlflow/BasicBlocks.qll b/cpp/ql/lib/semmle/code/cpp/controlflow/BasicBlocks.qll
index ebea83e47e5..53f7c71a7d3 100644
--- a/cpp/ql/lib/semmle/code/cpp/controlflow/BasicBlocks.qll
+++ b/cpp/ql/lib/semmle/code/cpp/controlflow/BasicBlocks.qll
@@ -12,7 +12,7 @@ private import internal.ConstantExprs
* relation). The refinement manifests itself in two changes:
*
* - The successor relation on `BasicBlock`s uses `successors_adapted`
- * (instead of `successors_extended` used by `PrimtiveBasicBlock`s). Consequently,
+ * (instead of `successors_extended` used by `PrimitiveBasicBlock`s). Consequently,
* some edges between `BasicBlock`s may be removed. Example:
* ```
* x = 1; // s1
diff --git a/cpp/ql/lib/semmle/code/cpp/controlflow/StackVariableReachability.qll b/cpp/ql/lib/semmle/code/cpp/controlflow/StackVariableReachability.qll
index 373ab8b79e2..3af5f2dbf0c 100644
--- a/cpp/ql/lib/semmle/code/cpp/controlflow/StackVariableReachability.qll
+++ b/cpp/ql/lib/semmle/code/cpp/controlflow/StackVariableReachability.qll
@@ -149,7 +149,7 @@ private predicate bbLoopEntryConditionAlwaysTrueAt(BasicBlock bb, int i, Control
/**
* Basic block `pred` contains all or part of the condition belonging to a loop,
* and there is an edge from `pred` to `succ` that concludes the condition.
- * If the edge corrseponds with the loop condition being found to be `true`, then
+ * If the edge corresponds with the loop condition being found to be `true`, then
* `skipsLoop` is `false`. Otherwise the edge corresponds with the loop condition
* being found to be `false` and `skipsLoop` is `true`. Non-concluding edges
* within a complex loop condition are not matched by this predicate.
diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll
+++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll
+++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll
+++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll
+++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll
+++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll b/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll
index f5ead5b6f5f..fa6589f7e27 100644
--- a/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll
+++ b/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll
@@ -1137,7 +1137,7 @@ class BuiltInOperationIsArray extends BuiltInOperation, @isarray {
* A C++ `__array_rank` built-in operation (used by some implementations of the
* `` header).
*
- * If known, returns the number of dimentsions of an arrary type.
+ * If known, returns the number of dimensions of an arrary type.
* ```
* template
* struct rank
diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Call.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Call.qll
index dba3d16997f..332cda770bb 100644
--- a/cpp/ql/lib/semmle/code/cpp/exprs/Call.qll
+++ b/cpp/ql/lib/semmle/code/cpp/exprs/Call.qll
@@ -494,7 +494,7 @@ class VacuousDestructorCall extends Expr, @vacuous_destructor_call {
* An initialization of a base class or member variable performed as part
* of a constructor's explicit initializer list or implicit actions.
*
- * This is a QL root class for reprenting various types of constructor
+ * This is a QL root class for representing various types of constructor
* initializations.
*/
class ConstructorInit extends Expr, @ctorinit {
diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Cast.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Cast.qll
index 3cb8946c198..e3ce623d217 100644
--- a/cpp/ql/lib/semmle/code/cpp/exprs/Cast.qll
+++ b/cpp/ql/lib/semmle/code/cpp/exprs/Cast.qll
@@ -779,7 +779,7 @@ class AlignofExprOperator extends AlignofOperator {
/**
* A C++11 `alignof` expression whose operand is a type name.
* ```
- * bool proper_alignment = (alingof(T) == alignof(T[0]);
+ * bool proper_alignment = (alignof(T) == alignof(T[0]);
* ```
*/
class AlignofTypeOperator extends AlignofOperator {
diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll
index 68973293425..9261cc4a13f 100644
--- a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll
+++ b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll
@@ -451,7 +451,7 @@ class Expr extends StmtParent, @expr {
// For performance, we avoid a full transitive closure over `getConversion`.
// Since there can be several implicit conversions before and after an
// explicit conversion, use `getImplicitlyConverted` to step over them
- // cheaply. Then, if there is an explicit conversion following the implict
+ // cheaply. Then, if there is an explicit conversion following the implicit
// conversion sequence, recurse to handle multiple explicit conversions.
if this.getImplicitlyConverted().hasExplicitConversion()
then result = this.getImplicitlyConverted().getConversion().getExplicitlyConverted()
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll
index 7359656e5a4..a14b2b00651 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll
@@ -100,7 +100,7 @@ private string getNodeProperty(DataFlow::Node node, string key) {
or
// Is there partial flow from a source to this node?
// This property will only be emitted if partial flow is enabled by overriding
- // `DataFlow::Configration::explorationLimit()`.
+ // `DataFlow::Configuration::explorationLimit()`.
key = "pflow" and
result =
strictconcat(DataFlow::PartialPathNode sourceNode, DataFlow::PartialPathNode destNode, int dist,
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll
index 8e863ddf635..7afe954023b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll
@@ -742,7 +742,7 @@ class NoOpInstruction extends Instruction {
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
* containing the `ExitFunction` instruction for that function.
*
- * There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
+ * There are two different return instructions: `ReturnValueInstruction`, for returning a value from
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
* `void`-returning function.
*/
@@ -1331,7 +1331,7 @@ class CheckedConvertOrThrowInstruction extends UnaryInstruction {
*
* If the operand holds a null address, the result is a null address.
*
- * This instruction is used to represent `dyanmic_cast` in C++, which returns the pointer to
+ * This instruction is used to represent `dynamic_cast` in C++, which returns the pointer to
* the most-derived object.
*/
class CompleteObjectAddressInstruction extends UnaryInstruction {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll
index d65ee10f402..efc927a05e6 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll
@@ -64,7 +64,7 @@ private module Cached {
or
instr = reusedPhiInstruction(_) and
// Check that the phi instruction is *not* degenerate, but we can't use
- // getDegeneratePhiOperand in the first stage with phi instyructions
+ // getDegeneratePhiOperand in the first stage with phi instructions
not exists(
unique(OldIR::PhiInputOperand operand |
operand = instr.(OldIR::PhiInstruction).getAnInputOperand() and
@@ -718,7 +718,7 @@ module DefUse {
}
/**
- * Gets the rank index of a hyphothetical use one instruction past the end of
+ * Gets the rank index of a hypothetical use one instruction past the end of
* the block. This index can be used to determine if a definition reaches the
* end of the block, even if the definition is the last instruction in the
* block.
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/TOperand.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/TOperand.qll
index bc69754fe32..607b88fa58d 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/TOperand.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/TOperand.qll
@@ -172,7 +172,7 @@ deprecated module UnaliasedSSAOperands = UnaliasedSsaOperands;
/**
* Provides wrappers for the constructors of each branch of `TOperand` that is used by the
- * asliased SSA stage.
+ * aliased SSA stage.
* These wrappers are not parameterized because it is not possible to invoke an IPA constructor via
* a class alias.
*/
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll
index 8e863ddf635..7afe954023b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll
@@ -742,7 +742,7 @@ class NoOpInstruction extends Instruction {
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
* containing the `ExitFunction` instruction for that function.
*
- * There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
+ * There are two different return instructions: `ReturnValueInstruction`, for returning a value from
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
* `void`-returning function.
*/
@@ -1331,7 +1331,7 @@ class CheckedConvertOrThrowInstruction extends UnaryInstruction {
*
* If the operand holds a null address, the result is a null address.
*
- * This instruction is used to represent `dyanmic_cast` in C++, which returns the pointer to
+ * This instruction is used to represent `dynamic_cast` in C++, which returns the pointer to
* the most-derived object.
*/
class CompleteObjectAddressInstruction extends UnaryInstruction {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll
index f8960cd205d..7d015654056 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll
@@ -542,7 +542,7 @@ class TranslatedArgumentExprSideEffect extends TranslatedArgumentSideEffect,
* The IR translation of an argument side effect for `*this` on a call, where there is no `Expr`
* object that represents the `this` argument.
*
- * The applies only to constructor calls, as the AST has explioit qualifier `Expr`s for all other
+ * The applies only to constructor calls, as the AST has exploit qualifier `Expr`s for all other
* calls to non-static member functions.
*/
class TranslatedStructorQualifierSideEffect extends TranslatedArgumentSideEffect,
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll
index 56da47325ee..df5a974c45b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll
@@ -2177,7 +2177,7 @@ abstract class TranslatedConditionalExpr extends TranslatedNonConstantExpr {
/**
* The IR translation of the ternary conditional operator (`a ? b : c`).
* For this version, we expand the condition as a `TranslatedCondition`, rather than a
- * `TranslatedExpr`, to simplify the control flow in the presence of short-ciruit logical operators.
+ * `TranslatedExpr`, to simplify the control flow in the presence of short-circuit logical operators.
*/
class TranslatedTernaryConditionalExpr extends TranslatedConditionalExpr, ConditionContext {
TranslatedTernaryConditionalExpr() { not expr.isTwoOperand() }
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll
index 8e863ddf635..7afe954023b 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll
@@ -742,7 +742,7 @@ class NoOpInstruction extends Instruction {
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
* containing the `ExitFunction` instruction for that function.
*
- * There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
+ * There are two different return instructions: `ReturnValueInstruction`, for returning a value from
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
* `void`-returning function.
*/
@@ -1331,7 +1331,7 @@ class CheckedConvertOrThrowInstruction extends UnaryInstruction {
*
* If the operand holds a null address, the result is a null address.
*
- * This instruction is used to represent `dyanmic_cast` in C++, which returns the pointer to
+ * This instruction is used to represent `dynamic_cast` in C++, which returns the pointer to
* the most-derived object.
*/
class CompleteObjectAddressInstruction extends UnaryInstruction {
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
index d65ee10f402..efc927a05e6 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
@@ -64,7 +64,7 @@ private module Cached {
or
instr = reusedPhiInstruction(_) and
// Check that the phi instruction is *not* degenerate, but we can't use
- // getDegeneratePhiOperand in the first stage with phi instyructions
+ // getDegeneratePhiOperand in the first stage with phi instructions
not exists(
unique(OldIR::PhiInputOperand operand |
operand = instr.(OldIR::PhiInstruction).getAnInputOperand() and
@@ -718,7 +718,7 @@ module DefUse {
}
/**
- * Gets the rank index of a hyphothetical use one instruction past the end of
+ * Gets the rank index of a hypothetical use one instruction past the end of
* the block. This index can be used to determine if a definition reaches the
* end of the block, even if the definition is the last instruction in the
* block.
diff --git a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRUtilities.qll b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRUtilities.qll
index 1415cdc9c5b..bfd850384ac 100644
--- a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRUtilities.qll
+++ b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRUtilities.qll
@@ -12,7 +12,7 @@ private Type getDecayedType(Type type) {
}
/**
- * Holds if the sepcified variable is a structured binding with a non-reference
+ * Holds if the specified variable is a structured binding with a non-reference
* type.
*/
predicate isNonReferenceStructuredBinding(Variable v) {
diff --git a/cpp/ql/lib/semmle/code/cpp/metrics/MetricFile.qll b/cpp/ql/lib/semmle/code/cpp/metrics/MetricFile.qll
index b3838ce4a5a..d9d7d286938 100644
--- a/cpp/ql/lib/semmle/code/cpp/metrics/MetricFile.qll
+++ b/cpp/ql/lib/semmle/code/cpp/metrics/MetricFile.qll
@@ -209,7 +209,7 @@ private predicate aClassFile(Class c, File file) { c.getDefinitionLocation().get
pragma[noopt]
private predicate dependsOnFileSimple(MetricFile source, MetricFile dest) {
- // class derives from classs
+ // class derives from another class
exists(Class fromClass, Class toClass |
aClassFile(fromClass, source) and
fromClass.derivesFrom(toClass) and
diff --git a/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll b/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll
index 325f6a6470b..028ab1a0370 100644
--- a/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll
+++ b/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll
@@ -205,57 +205,149 @@ private predicate deconstructSizeExpr(Expr sizeExpr, Expr lengthExpr, int sizeof
sizeof = 1
}
+/** A `Function` that is a call target of an allocation. */
+private signature class CallAllocationExprTarget extends Function;
+
/**
- * An allocation expression that is a function call, such as call to `malloc`.
+ * This module abstracts over the type of allocation call-targets and provides a
+ * class `CallAllocationExprImpl` which contains the implementation of the various
+ * predicates required by the `Allocation` class.
+ *
+ * This module is then instantiated for two types of allocation call-targets:
+ * - `AllocationFunction`: Functions that we've explicitly modeled as functions that
+ * perform allocations (i.e., `malloc`).
+ * - `HeuristicAllocationFunction`: Functions that we deduce as behaving like an allocation
+ * function using various heuristics.
*/
-private class CallAllocationExpr extends AllocationExpr, FunctionCall {
- AllocationFunction target;
+private module CallAllocationExprBase {
+ /** A module that contains the collection of member-predicates required on `Target`. */
+ signature module Param {
+ /**
+ * Gets the index of the input pointer argument to be reallocated, if
+ * this is a `realloc` function.
+ */
+ int getReallocPtrArg(Target target);
- CallAllocationExpr() {
- target = this.getTarget() and
- // realloc(ptr, 0) only frees the pointer
- not (
- exists(target.getReallocPtrArg()) and
- this.getArgument(target.getSizeArg()).getValue().toInt() = 0
- ) and
- // these are modeled directly (and more accurately), avoid duplication
- not exists(NewOrNewArrayExpr new | new.getAllocatorCall() = this)
+ /**
+ * Gets the index of the argument for the allocation size, if any. The actual
+ * allocation size is the value of this argument multiplied by the result of
+ * `getSizeMult()`, in bytes.
+ */
+ int getSizeArg(Target target);
+
+ /**
+ * Gets the index of an argument that multiplies the allocation size given
+ * by `getSizeArg`, if any.
+ */
+ int getSizeMult(Target target);
+
+ /**
+ * Holds if this allocation requires a
+ * corresponding deallocation of some sort (most do, but `alloca` for example
+ * does not). If it is unclear, we default to no (for example a placement `new`
+ * allocation may or may not require a corresponding `delete`).
+ */
+ predicate requiresDealloc(Target target);
}
- override Expr getSizeExpr() {
- exists(Expr sizeExpr | sizeExpr = this.getArgument(target.getSizeArg()) |
- if exists(target.getSizeMult())
- then result = sizeExpr
- else
- exists(Expr lengthExpr |
- deconstructSizeExpr(sizeExpr, lengthExpr, _) and
- result = lengthExpr
+ /**
+ * A module that abstracts over a collection of predicates in
+ * the `Param` module). This should really be member-predicates
+ * on `CallAllocationExprTarget`, but we cannot yet write this in QL.
+ */
+ module With {
+ private import P
+
+ /**
+ * An allocation expression that is a function call, such as call to `malloc`.
+ */
+ class CallAllocationExprImpl instanceof FunctionCall {
+ Target target;
+
+ CallAllocationExprImpl() {
+ target = this.getTarget() and
+ // realloc(ptr, 0) only frees the pointer
+ not (
+ exists(getReallocPtrArg(target)) and
+ this.getArgument(getSizeArg(target)).getValue().toInt() = 0
+ ) and
+ // these are modeled directly (and more accurately), avoid duplication
+ not exists(NewOrNewArrayExpr new | new.getAllocatorCall() = this)
+ }
+
+ string toString() { result = super.toString() }
+
+ Expr getSizeExprImpl() {
+ exists(Expr sizeExpr | sizeExpr = super.getArgument(getSizeArg(target)) |
+ if exists(getSizeMult(target))
+ then result = sizeExpr
+ else
+ exists(Expr lengthExpr |
+ deconstructSizeExpr(sizeExpr, lengthExpr, _) and
+ result = lengthExpr
+ )
)
- )
+ }
+
+ int getSizeMultImpl() {
+ // malloc with multiplier argument that is a constant
+ result = super.getArgument(getSizeMult(target)).getValue().toInt()
+ or
+ // malloc with no multiplier argument
+ not exists(getSizeMult(target)) and
+ deconstructSizeExpr(super.getArgument(getSizeArg(target)), _, result)
+ }
+
+ int getSizeBytesImpl() {
+ result = this.getSizeExprImpl().getValue().toInt() * this.getSizeMultImpl()
+ }
+
+ Expr getReallocPtrImpl() { result = super.getArgument(getReallocPtrArg(target)) }
+
+ Type getAllocatedElementTypeImpl() {
+ result =
+ super.getFullyConverted().getType().stripTopLevelSpecifiers().(PointerType).getBaseType() and
+ not result instanceof VoidType
+ }
+
+ predicate requiresDeallocImpl() { requiresDealloc(target) }
+ }
+ }
+}
+
+private module CallAllocationExpr {
+ private module Param implements CallAllocationExprBase::Param {
+ int getReallocPtrArg(AllocationFunction f) { result = f.getReallocPtrArg() }
+
+ int getSizeArg(AllocationFunction f) { result = f.getSizeArg() }
+
+ int getSizeMult(AllocationFunction f) { result = f.getSizeMult() }
+
+ predicate requiresDealloc(AllocationFunction f) { f.requiresDealloc() }
}
- override int getSizeMult() {
- // malloc with multiplier argument that is a constant
- result = this.getArgument(target.getSizeMult()).getValue().toInt()
- or
- // malloc with no multiplier argument
- not exists(target.getSizeMult()) and
- deconstructSizeExpr(this.getArgument(target.getSizeArg()), _, result)
+ /**
+ * A class that provides the implementation of `AllocationExpr` for an allocation
+ * that calls an `AllocationFunction`.
+ */
+ private class Base =
+ CallAllocationExprBase::With::CallAllocationExprImpl;
+
+ class CallAllocationExpr extends AllocationExpr, Base {
+ override Expr getSizeExpr() { result = super.getSizeExprImpl() }
+
+ override int getSizeMult() { result = super.getSizeMultImpl() }
+
+ override Type getAllocatedElementType() { result = super.getAllocatedElementTypeImpl() }
+
+ override predicate requiresDealloc() { super.requiresDeallocImpl() }
+
+ override int getSizeBytes() { result = super.getSizeBytesImpl() }
+
+ override Expr getReallocPtr() { result = super.getReallocPtrImpl() }
+
+ override string toString() { result = AllocationExpr.super.toString() }
}
-
- override int getSizeBytes() {
- result = this.getSizeExpr().getValue().toInt() * this.getSizeMult()
- }
-
- override Expr getReallocPtr() { result = this.getArgument(target.getReallocPtrArg()) }
-
- override Type getAllocatedElementType() {
- result =
- this.getFullyConverted().getType().stripTopLevelSpecifiers().(PointerType).getBaseType() and
- not result instanceof VoidType
- }
-
- override predicate requiresDealloc() { target.requiresDealloc() }
}
/**
@@ -294,3 +386,99 @@ private class NewArrayAllocationExpr extends AllocationExpr, NewArrayExpr {
override predicate requiresDealloc() { not exists(this.getPlacementPointer()) }
}
+
+private module HeuristicAllocation {
+ /** A class that maps an `AllocationExpr` to an `HeuristicAllocationExpr`. */
+ private class HeuristicAllocationModeled extends HeuristicAllocationExpr instanceof AllocationExpr {
+ override Expr getSizeExpr() { result = AllocationExpr.super.getSizeExpr() }
+
+ override int getSizeMult() { result = AllocationExpr.super.getSizeMult() }
+
+ override int getSizeBytes() { result = AllocationExpr.super.getSizeBytes() }
+
+ override Expr getReallocPtr() { result = AllocationExpr.super.getReallocPtr() }
+
+ override Type getAllocatedElementType() {
+ result = AllocationExpr.super.getAllocatedElementType()
+ }
+
+ override predicate requiresDealloc() { AllocationExpr.super.requiresDealloc() }
+ }
+
+ /** A class that maps an `AllocationFunction` to an `HeuristicAllocationFunction`. */
+ private class HeuristicAllocationFunctionModeled extends HeuristicAllocationFunction instanceof AllocationFunction {
+ override int getSizeArg() { result = AllocationFunction.super.getSizeArg() }
+
+ override int getSizeMult() { result = AllocationFunction.super.getSizeMult() }
+
+ override int getReallocPtrArg() { result = AllocationFunction.super.getReallocPtrArg() }
+
+ override predicate requiresDealloc() { AllocationFunction.super.requiresDealloc() }
+ }
+
+ private int getAnUnsignedParameter(Function f) {
+ f.getParameter(result).getUnspecifiedType().(IntegralType).isUnsigned()
+ }
+
+ private int getAPointerParameter(Function f) {
+ f.getParameter(result).getUnspecifiedType() instanceof PointerType
+ }
+
+ /**
+ * A class that uses heuristics to find additional allocation functions. The required are as follows:
+ * 1. The word `alloc` must appear in the function name
+ * 2. The function must return a pointer type
+ * 3. There must be a unique parameter of unsigned integral type.
+ */
+ private class HeuristicAllocationFunctionByName extends HeuristicAllocationFunction instanceof Function {
+ int sizeArg;
+
+ HeuristicAllocationFunctionByName() {
+ Function.super.getName().matches("%alloc%") and
+ Function.super.getUnspecifiedType() instanceof PointerType and
+ sizeArg = unique( | | getAnUnsignedParameter(this))
+ }
+
+ override int getSizeArg() { result = sizeArg }
+
+ override int getReallocPtrArg() {
+ Function.super.getName().matches("%realloc%") and
+ result = unique( | | getAPointerParameter(this))
+ }
+
+ override predicate requiresDealloc() { none() }
+ }
+
+ private module Param implements CallAllocationExprBase::Param {
+ int getReallocPtrArg(HeuristicAllocationFunction f) { result = f.getReallocPtrArg() }
+
+ int getSizeArg(HeuristicAllocationFunction f) { result = f.getSizeArg() }
+
+ int getSizeMult(HeuristicAllocationFunction f) { result = f.getSizeMult() }
+
+ predicate requiresDealloc(HeuristicAllocationFunction f) { f.requiresDealloc() }
+ }
+
+ /**
+ * A class that provides the implementation of `AllocationExpr` for an allocation
+ * that calls an `HeuristicAllocationFunction`.
+ */
+ private class Base =
+ CallAllocationExprBase::With::CallAllocationExprImpl;
+
+ private class CallAllocationExpr extends HeuristicAllocationExpr, Base {
+ override Expr getSizeExpr() { result = super.getSizeExprImpl() }
+
+ override int getSizeMult() { result = super.getSizeMultImpl() }
+
+ override Type getAllocatedElementType() { result = super.getAllocatedElementTypeImpl() }
+
+ override predicate requiresDealloc() { super.requiresDeallocImpl() }
+
+ override int getSizeBytes() { result = super.getSizeBytesImpl() }
+
+ override Expr getReallocPtr() { result = super.getReallocPtrImpl() }
+
+ override string toString() { result = HeuristicAllocationExpr.super.toString() }
+ }
+}
diff --git a/cpp/ql/lib/semmle/code/cpp/models/interfaces/Allocation.qll b/cpp/ql/lib/semmle/code/cpp/models/interfaces/Allocation.qll
index d309791f79a..00281f0f756 100644
--- a/cpp/ql/lib/semmle/code/cpp/models/interfaces/Allocation.qll
+++ b/cpp/ql/lib/semmle/code/cpp/models/interfaces/Allocation.qll
@@ -113,3 +113,84 @@ class OperatorNewAllocationFunction extends AllocationFunction {
result = 1
}
}
+
+/**
+ * An expression that _might_ allocate memory.
+ *
+ * Unlike `AllocationExpr`, this class uses heuristics (such as a call target's
+ * name and parameters) to include additional expressions.
+ */
+abstract class HeuristicAllocationExpr extends Expr {
+ /**
+ * Gets an expression for the allocation size, if any. The actual allocation
+ * size is the value of this expression multiplied by the result of
+ * `getSizeMult()`, in bytes.
+ */
+ Expr getSizeExpr() { none() }
+
+ /**
+ * Gets a constant multiplier for the allocation size given by `getSizeExpr`,
+ * in bytes.
+ */
+ int getSizeMult() { none() }
+
+ /**
+ * Gets the size of this allocation in bytes, if it is a fixed size and that
+ * size can be determined.
+ */
+ int getSizeBytes() { none() }
+
+ /**
+ * Gets the expression for the input pointer argument to be reallocated, if
+ * this is a `realloc` function.
+ */
+ Expr getReallocPtr() { none() }
+
+ /**
+ * Gets the type of the elements that are allocated, if it can be determined.
+ */
+ Type getAllocatedElementType() { none() }
+
+ /**
+ * Whether or not this allocation requires a corresponding deallocation of
+ * some sort (most do, but `alloca` for example does not). If it is unclear,
+ * we default to no (for example a placement `new` allocation may or may not
+ * require a corresponding `delete`).
+ */
+ predicate requiresDealloc() { any() }
+}
+
+/**
+ * An function that _might_ allocate memory.
+ *
+ * Unlike `AllocationFunction`, this class uses heuristics (such as the function's
+ * name and its parameters) to include additional functions.
+ */
+abstract class HeuristicAllocationFunction extends Function {
+ /**
+ * Gets the index of the argument for the allocation size, if any. The actual
+ * allocation size is the value of this argument multiplied by the result of
+ * `getSizeMult()`, in bytes.
+ */
+ int getSizeArg() { none() }
+
+ /**
+ * Gets the index of an argument that multiplies the allocation size given by
+ * `getSizeArg`, if any.
+ */
+ int getSizeMult() { none() }
+
+ /**
+ * Gets the index of the input pointer argument to be reallocated, if this
+ * is a `realloc` function.
+ */
+ int getReallocPtrArg() { none() }
+
+ /**
+ * Whether or not this allocation requires a corresponding deallocation of
+ * some sort (most do, but `alloca` for example does not). If it is unclear,
+ * we default to no (for example a placement `new` allocation may or may not
+ * require a corresponding `delete`).
+ */
+ predicate requiresDealloc() { any() }
+}
diff --git a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/RangeAnalysisUtils.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/RangeAnalysisUtils.qll
index 410a39716dc..4717e79d9d3 100644
--- a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/RangeAnalysisUtils.qll
+++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/RangeAnalysisUtils.qll
@@ -173,7 +173,7 @@ predicate eqOpWithSwapAndNegate(EqualityOperation cmp, Expr a, Expr b, boolean i
/**
* Holds if `cmp` is an unconverted conversion of `a` to a Boolean that
- * evalutes to `isEQ` iff `a` is 0.
+ * evaluates to `isEQ` iff `a` is 0.
*
* Note that `a` can be `cmp` itself or a conversion thereof.
*/
diff --git a/cpp/ql/lib/semmle/code/cpp/security/Encryption.qll b/cpp/ql/lib/semmle/code/cpp/security/Encryption.qll
index 00be9a3deb5..054b2087e53 100644
--- a/cpp/ql/lib/semmle/code/cpp/security/Encryption.qll
+++ b/cpp/ql/lib/semmle/code/cpp/security/Encryption.qll
@@ -51,14 +51,14 @@ string getInsecureAlgorithmRegex() {
/**
* Holds if `name` looks like it might be related to operations with an
- * insecure encyption algorithm.
+ * insecure encryption algorithm.
*/
bindingset[name]
predicate isInsecureEncryption(string name) { name.regexpMatch(getInsecureAlgorithmRegex()) }
/**
* Holds if there is additional evidence that `name` looks like it might be
- * related to operations with an encyption algorithm, besides the name of a
+ * related to operations with an encryption algorithm, besides the name of a
* specific algorithm. This can be used in conjunction with
* `isInsecureEncryption` to produce a stronger heuristic.
*/
diff --git a/cpp/ql/lib/semmle/code/cpp/security/TaintTrackingImpl.qll b/cpp/ql/lib/semmle/code/cpp/security/TaintTrackingImpl.qll
index 01230e6880c..532cf53e2d4 100644
--- a/cpp/ql/lib/semmle/code/cpp/security/TaintTrackingImpl.qll
+++ b/cpp/ql/lib/semmle/code/cpp/security/TaintTrackingImpl.qll
@@ -1,7 +1,7 @@
/**
* DEPRECATED: we now use `semmle.code.cpp.ir.dataflow.DefaultTaintTracking`,
* which is based on the IR but designed to behave similarly to this old
- * libarary.
+ * library.
*
* Provides the implementation of `semmle.code.cpp.security.TaintTracking`. Do
* not import this file directly.
diff --git a/cpp/ql/lib/semmle/code/cpp/valuenumbering/HashCons.qll b/cpp/ql/lib/semmle/code/cpp/valuenumbering/HashCons.qll
index 0073154dd3c..d3c212fb8a7 100644
--- a/cpp/ql/lib/semmle/code/cpp/valuenumbering/HashCons.qll
+++ b/cpp/ql/lib/semmle/code/cpp/valuenumbering/HashCons.qll
@@ -104,7 +104,7 @@ private newtype HC_Alloc =
HC_HasAlloc(HashCons hc) { mk_HasAlloc(hc, _) }
/**
- * Used to implement optional extent expression on `new[]` exprtessions
+ * Used to implement optional extent expression on `new[]` expressions
*/
private newtype HC_Extent =
HC_NoExtent() or
@@ -116,7 +116,7 @@ private newtype HC_Args =
HC_ArgCons(HashCons hc, int i, HC_Args list) { mk_ArgCons(hc, i, list, _) }
/**
- * Used to implement hash-consing of struct initizializers.
+ * Used to implement hash-consing of struct initializers.
*/
private newtype HC_Fields =
HC_EmptyFields(Class c) { exists(ClassAggregateLiteral cal | c = cal.getUnspecifiedType()) } or
diff --git a/cpp/ql/src/Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql b/cpp/ql/src/Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql
index 53c96c4beb7..ef9135f1c0a 100644
--- a/cpp/ql/src/Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql
+++ b/cpp/ql/src/Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql
@@ -35,4 +35,4 @@ from LocalVariableOrParameter lv, GlobalVariable gv
where
lv.getName() = gv.getName() and
lv.getFile() = gv.getFile()
-select lv, lv.type() + gv.getName() + " hides $@ with the same name.", gv, "a global variable"
+select lv, lv.type() + gv.getName() + " hides a $@ with the same name.", gv, "global variable"
diff --git a/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.cpp b/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.cpp
new file mode 100644
index 00000000000..77246363fba
--- /dev/null
+++ b/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.cpp
@@ -0,0 +1,32 @@
+/*
+ * In this example, the developer intended to use a semicolon but accidentally used a comma:
+ */
+
+enum privileges entitlements = NONE;
+
+if (is_admin)
+ entitlements = FULL, // BAD
+
+restrict_privileges(entitlements);
+
+/*
+ * The use of a comma means that the first example is equivalent to this second example:
+ */
+
+enum privileges entitlements = NONE;
+
+if (is_admin) {
+ entitlements = FULL;
+ restrict_privileges(entitlements);
+}
+
+/*
+ * The indentation of the first example suggests that the developer probably intended the following code:
+ */
+
+enum privileges entitlements = NONE;
+
+if (is_admin)
+ entitlements = FULL; // GOOD
+
+restrict_privileges(entitlements);
diff --git a/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.qhelp b/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.qhelp
new file mode 100644
index 00000000000..d0aa29ca700
--- /dev/null
+++ b/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.qhelp
@@ -0,0 +1,39 @@
+
+
+
+
+
+If the expression after the comma operator starts at an earlier column than the expression before the comma, then
+this suspicious indentation possibly indicates a logic error, caused by a typo that may escape visual inspection.
+
+
+This query has medium precision because CodeQL currently does not distinguish between tabs and spaces in whitespace.
+If a file contains mixed tabs and spaces, alerts may highlight code that is correctly indented for one value of tab size but not for other tab sizes.
+
+
+
+
+
+To ensure that your code is easy to read and review, use standard indentation around the comma operator. Always begin the right-hand-side operand at the same level of
+indentation (column number) as the left-hand-side operand. This makes it easier for other developers to see the intended behavior of your code.
+
+
+Use whitespace consistently to communicate your coding intentions. Where possible, avoid mixing tabs and spaces within a file. If you need to mix them, use them consistently.
+
+
+
+
+
+This example shows three different ways of writing the same code. The first example contains a comma instead of a semicolon which means that the final line is part of the if statement, even though the indentation suggests that it is intended to be separate. The second example looks different but is functionally the same as the first example. It is more likely that the developer intended to write the third example.
+
+
+
+
+
+Wikipedia: Comma operator
+Wikipedia: Indentation style — Tabs, spaces, and size of indentations
+
+
+
diff --git a/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql b/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql
new file mode 100644
index 00000000000..b23234d4627
--- /dev/null
+++ b/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql
@@ -0,0 +1,53 @@
+/**
+ * @name Comma before misleading indentation
+ * @description If expressions before and after a comma operator use different indentation, it is easy to misread the purpose of the code.
+ * @kind problem
+ * @id cpp/comma-before-misleading-indentation
+ * @problem.severity warning
+ * @security-severity 7.8
+ * @precision medium
+ * @tags maintainability
+ * readability
+ * security
+ * external/cwe/cwe-1078
+ * external/cwe/cwe-670
+ */
+
+import cpp
+import semmle.code.cpp.commons.Exclusions
+
+/** Gets the sub-expression of 'e' with the earliest-starting Location */
+Expr normalizeExpr(Expr e) {
+ result =
+ min(Expr child |
+ child.getParentWithConversions*() = e.getFullyConverted() and
+ not child.getParentWithConversions*() = any(Call c).getAnArgument()
+ |
+ child order by child.getLocation().getStartColumn(), count(child.getParentWithConversions*())
+ )
+}
+
+predicate isParenthesized(CommaExpr ce) {
+ ce.getParent*().(Expr).isParenthesised()
+ or
+ ce.isUnevaluated() // sizeof(), decltype(), alignof(), noexcept(), typeid()
+ or
+ ce.getParent*() = [any(IfStmt i).getCondition(), any(SwitchStmt s).getExpr()]
+ or
+ ce.getParent*() = [any(Loop l).getCondition(), any(ForStmt f).getUpdate()]
+ or
+ ce.getEnclosingStmt() = any(ForStmt f).getInitialization()
+}
+
+from CommaExpr ce, Expr left, Expr right, Location leftLoc, Location rightLoc
+where
+ ce.fromSource() and
+ not isFromMacroDefinition(ce) and
+ left = normalizeExpr(ce.getLeftOperand()) and
+ right = normalizeExpr(ce.getRightOperand()) and
+ leftLoc = left.getLocation() and
+ rightLoc = right.getLocation() and
+ not isParenthesized(ce) and
+ leftLoc.getEndLine() < rightLoc.getStartLine() and
+ leftLoc.getStartColumn() > rightLoc.getStartColumn()
+select right, "The indentation level may be misleading for some tab sizes."
diff --git a/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticFunctions.ql b/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticFunctions.ql
index 418250d15ac..514cfac9a81 100644
--- a/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticFunctions.ql
+++ b/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticFunctions.ql
@@ -13,16 +13,32 @@
import cpp
+pragma[noinline]
+predicate possiblyIncompleteFile(File f) {
+ exists(Diagnostic d | d.getFile() = f and d.getSeverity() >= 3)
+}
+
predicate immediatelyReachableFunction(Function f) {
- not f.isStatic() or
- exists(BlockExpr be | be.getFunction() = f) or
- f instanceof MemberFunction or
- f instanceof TemplateFunction or
- f.getFile() instanceof HeaderFile or
- f.getAnAttribute().hasName("constructor") or
- f.getAnAttribute().hasName("destructor") or
- f.getAnAttribute().hasName("used") or
+ not f.isStatic()
+ or
+ exists(BlockExpr be | be.getFunction() = f)
+ or
+ f instanceof MemberFunction
+ or
+ f instanceof TemplateFunction
+ or
+ f.getFile() instanceof HeaderFile
+ or
+ f.getAnAttribute().hasName("constructor")
+ or
+ f.getAnAttribute().hasName("destructor")
+ or
+ f.getAnAttribute().hasName("used")
+ or
f.getAnAttribute().hasName("unused")
+ or
+ // a compiler error in the same file suggests we may be missing data
+ possiblyIncompleteFile(f.getFile())
}
predicate immediatelyReachableVariable(Variable v) {
diff --git a/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.qhelp b/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.qhelp
index 6e0c263e4fa..b8838c26c52 100644
--- a/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.qhelp
+++ b/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.qhelp
@@ -11,7 +11,7 @@ caused by an unhandled case.
-Check that the unused static variable does not indicate a defect, for example, an unhandled case. If the static variable is genuinuely not needed,
+
Check that the unused static variable does not indicate a defect, for example, an unhandled case. If the static variable is genuinely not needed,
then removing it will make code more readable. If the static variable is needed then you should update the code to fix the defect.
diff --git a/cpp/ql/src/CHANGELOG.md b/cpp/ql/src/CHANGELOG.md
index 54dec3b197f..14b2976282b 100644
--- a/cpp/ql/src/CHANGELOG.md
+++ b/cpp/ql/src/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.4.1
+
+### Minor Analysis Improvements
+
+* The alert message of many queries have been changed to better follow the style guide and make the message consistent with other languages.
+
## 0.4.0
### New Queries
@@ -119,7 +125,7 @@
* The `security` tag has been added to the `cpp/return-stack-allocated-memory` query. As a result, its results will now appear by default.
* The "Uncontrolled data in arithmetic expression" (cpp/uncontrolled-arithmetic) query has been enhanced to reduce false positive results and its @precision increased to high.
-* A new `cpp/very-likely-overruning-write` query has been added to the default query suite for C/C++. The query reports some results that were formerly flagged by `cpp/overruning-write`.
+* A new `cpp/very-likely-overrunning-write` query has been added to the default query suite for C/C++. The query reports some results that were formerly flagged by `cpp/overrunning-write`.
### Minor Analysis Improvements
diff --git a/cpp/ql/src/Critical/DescriptorMayNotBeClosed.qhelp b/cpp/ql/src/Critical/DescriptorMayNotBeClosed.qhelp
index 2016e05d936..41473d68371 100644
--- a/cpp/ql/src/Critical/DescriptorMayNotBeClosed.qhelp
+++ b/cpp/ql/src/Critical/DescriptorMayNotBeClosed.qhelp
@@ -19,7 +19,7 @@ This can occur when an operation performed on the open descriptor fails, and the
In the example below, the sockfd socket may remain open if an error is triggered.
-The code should be updated to ensure that the socket is always closed when when the function ends.
+The code should be updated to ensure that the socket is always closed when the function ends.
diff --git a/cpp/ql/src/Critical/MemoryMayNotBeFreed.ql b/cpp/ql/src/Critical/MemoryMayNotBeFreed.ql
index b004aa835b9..d2afdad1306 100644
--- a/cpp/ql/src/Critical/MemoryMayNotBeFreed.ql
+++ b/cpp/ql/src/Critical/MemoryMayNotBeFreed.ql
@@ -63,7 +63,7 @@ predicate verifiedRealloc(FunctionCall reallocCall, Variable v, ControlFlowNode
node.(AnalysedExpr).getNonNullSuccessor(newV) = verified and
// note: this case uses naive flow logic (getAnAssignedValue).
// special case: if the result of the 'realloc' is assigned to the
- // same variable, we don't descriminate properly between the old
+ // same variable, we don't discriminate properly between the old
// and the new allocation; better to not consider this a free at
// all in that case.
newV != v
diff --git a/cpp/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql b/cpp/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
index a762abceb20..d3768c36106 100644
--- a/cpp/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
+++ b/cpp/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
@@ -3,6 +3,7 @@
* @description Lists all files in the source code directory that were extracted without encountering a problem in the file.
* @kind diagnostic
* @id cpp/diagnostics/successfully-extracted-files
+ * @tags successfully-extracted-files
*/
import cpp
diff --git a/cpp/ql/src/Documentation/DocumentApi.qhelp b/cpp/ql/src/Documentation/DocumentApi.qhelp
index 9bc19d35056..4154e5cebc4 100644
--- a/cpp/ql/src/Documentation/DocumentApi.qhelp
+++ b/cpp/ql/src/Documentation/DocumentApi.qhelp
@@ -15,7 +15,7 @@ As an exception, because their purpose is usually obvious, it is not necessary t
-Add comments to document the purpose of the function. In particular, ensure that the public API of the function is carefully documented. This reduces the chance that a future change to the function will introduce a defect by changing the API and breaking the expections of the calling functions.
+Add comments to document the purpose of the function. In particular, ensure that the public API of the function is carefully documented. This reduces the chance that a future change to the function will introduce a defect by changing the API and breaking the expectations of the calling functions.
diff --git a/cpp/ql/src/Likely Bugs/Arithmetic/ComparisonPrecedence.qhelp b/cpp/ql/src/Likely Bugs/Arithmetic/ComparisonPrecedence.qhelp
index aef03996053..5cae8407887 100644
--- a/cpp/ql/src/Likely Bugs/Arithmetic/ComparisonPrecedence.qhelp
+++ b/cpp/ql/src/Likely Bugs/Arithmetic/ComparisonPrecedence.qhelp
@@ -6,7 +6,7 @@
-This rule finds comparison expressions that use 2 or more comparison operators and are not completely paranthesized.
+This rule finds comparison expressions that use 2 or more comparison operators and are not completely parenthesized.
It is best to fully parenthesize complex comparison expressions to explicitly define the order of the comparison operators.
diff --git a/cpp/ql/src/Likely Bugs/ContinueInFalseLoop.ql b/cpp/ql/src/Likely Bugs/ContinueInFalseLoop.ql
index 293595d60d8..5b16fc7cf8f 100644
--- a/cpp/ql/src/Likely Bugs/ContinueInFalseLoop.ql
+++ b/cpp/ql/src/Likely Bugs/ContinueInFalseLoop.ql
@@ -23,7 +23,7 @@ DoStmt getAFalseLoop() {
/**
* Gets a `do` ... `while` loop surrounding a statement. This is blocked by a
* `switch` statement, since a `continue` inside a `switch` inside a loop may be
- * jusitifed (`continue` breaks out of the loop whereas `break` only escapes the
+ * justified (`continue` breaks out of the loop whereas `break` only escapes the
* `switch`).
*/
DoStmt enclosingLoop(Stmt s) {
diff --git a/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql b/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql
index 66af4f3e22d..18540ad6f02 100644
--- a/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql
+++ b/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql
@@ -25,8 +25,11 @@ class CastToPointerArithFlow extends DataFlow::Configuration {
override predicate isSource(DataFlow::Node node) {
not node.asExpr() instanceof Conversion and
- introducesNewField(node.asExpr().getType().(DerivedType).getBaseType(),
- node.asExpr().getConversion*().getType().(DerivedType).getBaseType())
+ exists(Type baseType1, Type baseType2 |
+ hasBaseType(node.asExpr(), baseType1) and
+ hasBaseType(node.asExpr().getConversion*(), baseType2) and
+ introducesNewField(baseType1, baseType2)
+ )
}
override predicate isSink(DataFlow::Node node) {
@@ -35,6 +38,17 @@ class CastToPointerArithFlow extends DataFlow::Configuration {
}
}
+/**
+ * Holds if the type of `e` is a `DerivedType` with `base` as its base type.
+ *
+ * This predicate ensures that joins go from `e` to `base` instead
+ * of the other way around.
+ */
+pragma[inline]
+predicate hasBaseType(Expr e, Type base) {
+ pragma[only_bind_into](base) = e.getType().(DerivedType).getBaseType()
+}
+
/**
* `derived` has a (possibly indirect) base class of `base`, and at least one new
* field has been introduced in the inheritance chain after `base`.
diff --git a/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.qhelp b/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.qhelp
index 37b78dd368c..bac09fe9cf1 100644
--- a/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.qhelp
+++ b/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.qhelp
@@ -6,9 +6,9 @@
This rule finds logical-not operator usage as an operator for in a bit-wise operation.
-Due to the nature of logical operation result value, only the lowest bit could possibly be set, and it is unlikely to be intent in bitwise opeartions. Violations are often indicative of a typo, using a logical-not (!) opeartor instead of the bit-wise not (~) operator.
+Due to the nature of logical operation result value, only the lowest bit could possibly be set, and it is unlikely to be intent in bitwise operations. Violations are often indicative of a typo, using a logical-not (!) operator instead of the bit-wise not (~) operator.
This rule is restricted to analyze bit-wise and (&) and bit-wise or (|) operation in order to provide better precision.
-This rule ignores instances where a double negation (!!) is explicitly used as the opeartor of the bitwise operation, as this is a commonly used as a mechanism to normalize an integer value to either 1 or 0.
+This rule ignores instances where a double negation (!!) is explicitly used as the operator of the bitwise operation, as this is a commonly used as a mechanism to normalize an integer value to either 1 or 0.
NOTE: It is not recommended to use this rule in kernel code or older C code as it will likely find several false positive instances.
diff --git a/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql b/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql
index 9c0230d7514..8f7b9a4554f 100644
--- a/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql
+++ b/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql
@@ -17,7 +17,7 @@ import cpp
/**
* It's common in some projects to use "a double negation" to normalize the boolean
* result to either 1 or 0.
- * This predciate is intended to filter explicit usage of a double negation as it typically
+ * This predicate is intended to filter explicit usage of a double negation as it typically
* indicates the explicit purpose to normalize the result for bit-wise or arithmetic purposes.
*/
predicate doubleNegationNormalization(NotExpr notexpr) { notexpr.getAnOperand() instanceof NotExpr }
diff --git a/cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.ql b/cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.ql
index f563e5b5f9e..5d03ccc44ea 100644
--- a/cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.ql
+++ b/cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.ql
@@ -3,7 +3,7 @@
* @name Untrusted network-to-host usage
* @description Using the result of a network-to-host byte order function, such as ntohl, as an
* array bound or length value without checking it may result in buffer overflows or
- * other vulnerabilties.
+ * other vulnerabilities.
* @kind problem
* @problem.severity error
*/
diff --git a/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp b/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp
index 5cc0ae21af9..fe25fae8f4a 100644
--- a/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp
+++ b/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp
@@ -49,7 +49,7 @@ pointer overflow.
While it's not the subject of this query, the expression ptr + i <
-ptr_end is also an invalid range check. It's undefined behavor in
+ptr_end is also an invalid range check. It's undefined behavior in
C/C++ to create a pointer that points more than one past the end of an
allocation.
diff --git a/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql b/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql
index ed1d4084993..26c8ae4c258 100644
--- a/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql
+++ b/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql
@@ -44,7 +44,7 @@ class ReturnStackAllocatedMemoryConfig extends MustFlowConfiguration {
// Holds if `sink` is a node that represents the `StoreInstruction` that is subsequently used in
// a `ReturnValueInstruction`.
// We use the `StoreInstruction` instead of the instruction that defines the
- // `ReturnValueInstruction`'s source value oprand because the former has better location information.
+ // `ReturnValueInstruction`'s source value operand because the former has better location information.
exists(StoreInstruction store |
store.getDestinationAddress().(VariableAddressInstruction).getIRVariable() instanceof
IRReturnVariable and
diff --git a/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.qhelp b/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.qhelp
index 13c1e6d2710..3ffc326585f 100644
--- a/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.qhelp
+++ b/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.qhelp
@@ -12,7 +12,7 @@ the third argument to the entire size of the destination buffer.
Executing a call of this type may cause a buffer overflow unless the buffer is known to be empty.
Similarly, calls of the form strncat(dest, src, sizeof (dest) - strlen (dest)) allow one
-byte to be written ouside the dest buffer.
+byte to be written outside the dest buffer.
Buffer overflows can lead to anything from a segmentation fault to a security vulnerability.
diff --git a/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql b/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql
index 644c48622a2..0d46332a40a 100644
--- a/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql
+++ b/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql
@@ -24,7 +24,7 @@ import semmle.code.cpp.valuenumbering.GlobalValueNumbering
* Holds if `call` is a call to `strncat` such that `sizeArg` and `destArg` are the size and
* destination arguments, respectively.
*/
-predicate interestringCallWithArgs(Call call, Expr sizeArg, Expr destArg) {
+predicate interestingCallWithArgs(Call call, Expr sizeArg, Expr destArg) {
exists(StrcatFunction strcat |
strcat = call.getTarget() and
sizeArg = call.getArgument(strcat.getParamSize()) and
@@ -37,7 +37,7 @@ predicate interestringCallWithArgs(Call call, Expr sizeArg, Expr destArg) {
* argument `destArg`, and `destArg` is the size of the buffer pointed to by `destArg`.
*/
predicate case1(FunctionCall fc, Expr sizeArg, VariableAccess destArg) {
- interestringCallWithArgs(fc, sizeArg, destArg) and
+ interestingCallWithArgs(fc, sizeArg, destArg) and
exists(VariableAccess va |
va = sizeArg.(BufferSizeExpr).getArg() and
destArg.getTarget() = va.getTarget()
@@ -49,7 +49,7 @@ predicate case1(FunctionCall fc, Expr sizeArg, VariableAccess destArg) {
* argument `destArg`, and `sizeArg` computes the value `sizeof (dest) - strlen (dest)`.
*/
predicate case2(FunctionCall fc, Expr sizeArg, VariableAccess destArg) {
- interestringCallWithArgs(fc, sizeArg, destArg) and
+ interestingCallWithArgs(fc, sizeArg, destArg) and
exists(SubExpr sub, int n |
// The destination buffer is an array of size n
destArg.getUnspecifiedType().(ArrayType).getSize() = n and
diff --git a/cpp/ql/src/Likely Bugs/ShortLoopVarName.ql b/cpp/ql/src/Likely Bugs/ShortLoopVarName.ql
index 87dee3c8e30..298e4c1051a 100644
--- a/cpp/ql/src/Likely Bugs/ShortLoopVarName.ql
+++ b/cpp/ql/src/Likely Bugs/ShortLoopVarName.ql
@@ -48,5 +48,5 @@ where
not coordinatePair(iterationVar, innerVar)
select iterationVar,
"Iteration variable " + iterationVar.getName() +
- " for $@ should have a descriptive name, since there is $@.", outer, "this loop", inner,
- "a nested loop"
+ " for $@ should have a descriptive name, since there is a $@.", outer, "this loop", inner,
+ "nested loop"
diff --git a/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.c b/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.c
index a4c943f556c..c386a171e6b 100644
--- a/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.c
+++ b/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.c
@@ -1,4 +1,4 @@
-/* '#include ' was forgotton */
+/* '#include ' was forgotten */
int main(void) {
/* 'int malloc()' assumed */
diff --git a/cpp/ql/src/Metrics/Classes/CLackOfCohesionCK.qhelp b/cpp/ql/src/Metrics/Classes/CLackOfCohesionCK.qhelp
index f283056d2a8..1af359e5c50 100644
--- a/cpp/ql/src/Metrics/Classes/CLackOfCohesionCK.qhelp
+++ b/cpp/ql/src/Metrics/Classes/CLackOfCohesionCK.qhelp
@@ -6,7 +6,7 @@
This metric provides an indication of the lack of cohesion of a class,
using a method proposed by Chidamber and Kemerer in 1994. The idea
-behind measuring a class's cohesion is that most funcions in well-designed
+behind measuring a class's cohesion is that most functions in well-designed
classes will access the same fields. Types that exhibit a lack of cohesion
are often trying to take on multiple responsibilities, and should be split
into several smaller classes.
diff --git a/cpp/ql/src/Metrics/Namespaces/StableNamespaces.qhelp b/cpp/ql/src/Metrics/Namespaces/StableNamespaces.qhelp
index 44bdc327634..13eef3113da 100644
--- a/cpp/ql/src/Metrics/Namespaces/StableNamespaces.qhelp
+++ b/cpp/ql/src/Metrics/Namespaces/StableNamespaces.qhelp
@@ -11,7 +11,7 @@
by changes to other packages. If this metric value is high, a package is easily
influenced. If the values is low, the impact of changes to other packages is likely to be minimal. Instability
is estimated as the number of outgoing dependencies relative to the total
- number of depencies.
+ number of dependencies.
diff --git a/cpp/ql/src/Metrics/Namespaces/UnstableNamespaces.qhelp b/cpp/ql/src/Metrics/Namespaces/UnstableNamespaces.qhelp
index bac1609760b..2f6620f95aa 100644
--- a/cpp/ql/src/Metrics/Namespaces/UnstableNamespaces.qhelp
+++ b/cpp/ql/src/Metrics/Namespaces/UnstableNamespaces.qhelp
@@ -11,7 +11,7 @@
by changes to other packages. If this metric value is high, a package is easily
influenced. If the values is low, the impact of changes to other packages is likely to be minimal. Instability
is estimated as the number of outgoing dependencies relative to the total
- number of depencies.
+ number of dependencies.
diff --git a/cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.ql b/cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.ql
index 438e87a501a..00c8636369b 100644
--- a/cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.ql
+++ b/cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.ql
@@ -26,7 +26,7 @@ where
dest = bw.getDest() and
destSize = getBufferSize(dest, _) and
estimated = bw.getMaxDataLimited(reason) and
- // we exclude ValueFlowAnalysis as it is reported in cpp/very-likely-overruning-write
+ // we exclude ValueFlowAnalysis as it is reported in cpp/very-likely-overrunning-write
not reason instanceof ValueFlowAnalysis and
// we can deduce that too much data may be copied (even without
// long '%f' conversions)
diff --git a/cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql b/cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql
index d5892844370..9c456f71bbb 100644
--- a/cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql
+++ b/cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql
@@ -56,29 +56,26 @@ class VarargsFunction extends Function {
result = strictcount(FunctionCall fc | fc = this.getACallToThisFunction())
}
- string normalTerminator(int cnt) {
+ string normalTerminator(int cnt, int totalCount) {
+ // the terminator is 0 or -1
result = ["0", "-1"] and
+ // at least 80% of calls have the terminator
cnt = this.trailingArgValueCount(result) and
- 2 * cnt > this.totalCount() and
- not exists(FunctionCall fc, int index |
- // terminator value is used in a non-terminating position
- this.nonTrailingVarArgValue(fc, index) = result
- )
+ totalCount = this.totalCount() and
+ 100 * cnt / totalCount >= 80 and
+ // terminator value is not used in a non-terminating position
+ not exists(FunctionCall fc, int index | this.nonTrailingVarArgValue(fc, index) = result)
}
- predicate isWhitelisted() {
- this.hasGlobalName("open") or
- this.hasGlobalName("fcntl") or
- this.hasGlobalName("ptrace")
- }
+ predicate isWhitelisted() { this.hasGlobalName(["open", "fcntl", "ptrace", "mremap"]) }
}
-from VarargsFunction f, FunctionCall fc, string terminator, int cnt
+from VarargsFunction f, FunctionCall fc, string terminator, int cnt, int totalCount
where
- terminator = f.normalTerminator(cnt) and
+ terminator = f.normalTerminator(cnt, totalCount) and
fc = f.getACallToThisFunction() and
not normalisedExprValue(f.trailingArgumentIn(fc)) = terminator and
not f.isWhitelisted()
select fc,
- "Calls to $@ should use the value " + terminator + " as a terminator (" + cnt + " calls do).", f,
- f.getQualifiedName()
+ "Calls to $@ should use the value " + terminator + " as a terminator (" + cnt + " of " +
+ totalCount + " calls do).", f, f.getQualifiedName()
diff --git a/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql b/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
index 76ee3b60e13..964b2ff33d8 100644
--- a/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
+++ b/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
@@ -135,5 +135,5 @@ where
sink.getNode().asExpr() = va and
missingGuard(va, effect)
select sink.getNode(), source, sink,
- "Arithmetic expression depends on an $@, potentially causing an " + effect + ".",
+ "This arithmetic expression depends on an $@, potentially causing an " + effect + ".",
getExpr(source.getNode()), "uncontrolled value"
diff --git a/cpp/ql/src/Security/CWE/CWE-190/Bounded.qll b/cpp/ql/src/Security/CWE/CWE-190/Bounded.qll
index b6b0d608d2a..ff5c347e5e2 100644
--- a/cpp/ql/src/Security/CWE/CWE-190/Bounded.qll
+++ b/cpp/ql/src/Security/CWE/CWE-190/Bounded.qll
@@ -31,7 +31,7 @@ predicate bounded(Expr e) {
) and
not convertedExprMightOverflow(e)
or
- // Optimitically assume that a remainder expression always yields a much smaller value.
+ // Optimistically assume that a remainder expression always yields a much smaller value.
e = any(RemExpr rem).getLeftOperand()
or
e = any(AssignRemExpr rem).getLValue()
@@ -44,7 +44,7 @@ predicate bounded(Expr e) {
boundedBitwiseAnd(e, andExpr, andExpr.getAnOperand(), andExpr.getAnOperand())
)
or
- // Optimitically assume that a division always yields a much smaller value.
+ // Optimistically assume that a division always yields a much smaller value.
e = any(DivExpr div).getLeftOperand()
or
e = any(AssignDivExpr div).getLValue()
diff --git a/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.qhelp b/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.qhelp
index 519d21fd8c1..11d824c2d41 100644
--- a/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.qhelp
+++ b/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.qhelp
@@ -5,7 +5,7 @@
This query indicates that a call is setting the DACL field in a SECURITY_DESCRIPTOR to null.
- When using SetSecurityDescriptorDacl to set a discretionary access control (DACL), setting the bDaclPresent argument to TRUE indicates the prescence of a DACL in the security description in the argument pDacl.
+ When using SetSecurityDescriptorDacl to set a discretionary access control (DACL), setting the bDaclPresent argument to TRUE indicates the presence of a DACL in the security description in the argument pDacl.
When the pDacl parameter does not point to a DACL (i.e. it is NULL) and the bDaclPresent flag is TRUE, a NULL DACL is specified.
A NULL DACL grants full access to any user who requests it; normal security checking is not performed with respect to the object.
diff --git a/cpp/ql/src/change-notes/2022-09-21-unused-static-function.md b/cpp/ql/src/change-notes/2022-09-21-unused-static-function.md
new file mode 100644
index 00000000000..80bd25b7179
--- /dev/null
+++ b/cpp/ql/src/change-notes/2022-09-21-unused-static-function.md
@@ -0,0 +1,4 @@
+---
+category: minorAnalysis
+---
+* Fixed false positives from the "Unused static function" (`cpp/unused-static-function`) query in files that had errors during compilation.
diff --git a/cpp/ql/src/change-notes/2022-09-30-comma-before-missing-indentation.md b/cpp/ql/src/change-notes/2022-09-30-comma-before-missing-indentation.md
new file mode 100644
index 00000000000..dad3b0b3377
--- /dev/null
+++ b/cpp/ql/src/change-notes/2022-09-30-comma-before-missing-indentation.md
@@ -0,0 +1,4 @@
+---
+category: newQuery
+---
+* Added a new medium-precision query, `cpp/comma-before-misleading-indentation`, which detects instances of whitespace that have readability issues.
diff --git a/cpp/ql/src/change-notes/2022-10-06-unterminated-variadic-call.md b/cpp/ql/src/change-notes/2022-10-06-unterminated-variadic-call.md
new file mode 100644
index 00000000000..d986ba666ff
--- /dev/null
+++ b/cpp/ql/src/change-notes/2022-10-06-unterminated-variadic-call.md
@@ -0,0 +1,4 @@
+---
+category: minorAnalysis
+---
+* The "Unterminated variadic call" (`cpp/unterminated-variadic-call`) query has been tuned to produce fewer false positive results.
diff --git a/cpp/ql/src/change-notes/released/0.0.8.md b/cpp/ql/src/change-notes/released/0.0.8.md
index 268d87d92a7..c9739887dd5 100644
--- a/cpp/ql/src/change-notes/released/0.0.8.md
+++ b/cpp/ql/src/change-notes/released/0.0.8.md
@@ -4,7 +4,7 @@
* The `security` tag has been added to the `cpp/return-stack-allocated-memory` query. As a result, its results will now appear by default.
* The "Uncontrolled data in arithmetic expression" (cpp/uncontrolled-arithmetic) query has been enhanced to reduce false positive results and its @precision increased to high.
-* A new `cpp/very-likely-overruning-write` query has been added to the default query suite for C/C++. The query reports some results that were formerly flagged by `cpp/overruning-write`.
+* A new `cpp/very-likely-overrunning-write` query has been added to the default query suite for C/C++. The query reports some results that were formerly flagged by `cpp/overrunning-write`.
### Minor Analysis Improvements
diff --git a/cpp/ql/src/change-notes/released/0.4.1.md b/cpp/ql/src/change-notes/released/0.4.1.md
new file mode 100644
index 00000000000..f5e1dbf00ed
--- /dev/null
+++ b/cpp/ql/src/change-notes/released/0.4.1.md
@@ -0,0 +1,5 @@
+## 0.4.1
+
+### Minor Analysis Improvements
+
+* The alert message of many queries have been changed to better follow the style guide and make the message consistent with other languages.
diff --git a/cpp/ql/src/codeql-pack.release.yml b/cpp/ql/src/codeql-pack.release.yml
index 458bfbeccff..89fa3a87180 100644
--- a/cpp/ql/src/codeql-pack.release.yml
+++ b/cpp/ql/src/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 0.4.0
+lastReleaseVersion: 0.4.1
diff --git a/cpp/ql/src/definitions.ql b/cpp/ql/src/definitions.ql
index 84ef77fdc9d..c12277eaf23 100644
--- a/cpp/ql/src/definitions.ql
+++ b/cpp/ql/src/definitions.ql
@@ -13,6 +13,6 @@ where
def = definitionOf(e, kind) and
// We need to exclude definitions for elements inside template instantiations,
// as these often lead to multiple links to definitions from the same source location.
- // LGTM does not support this bevaviour.
+ // LGTM does not support this behaviour.
not e.isFromTemplateInstantiation(_)
select e, def, kind
diff --git a/cpp/ql/src/experimental/Best Practices/WrongUintAccess.ql b/cpp/ql/src/experimental/Best Practices/WrongUintAccess.ql
index ee1cca9b6e9..e13ea7091ba 100644
--- a/cpp/ql/src/experimental/Best Practices/WrongUintAccess.ql
+++ b/cpp/ql/src/experimental/Best Practices/WrongUintAccess.ql
@@ -1,7 +1,7 @@
/**
* @id cpp/wrong-uint-access
* @name Wrong Uint
- * @descripion Acess an array of size lower than 256 with a uint16.
+ * @description Access an array of size lower than 256 with a uint16.
* @kind problem
* @problem.severity recommendation
* @tags efficiency
@@ -21,5 +21,5 @@ where
) and
defLine.getArraySize() <= 256
select useExpr,
- "Using a " + useExpr.getArrayOffset().getType() + " to acess the array $@ of size " +
+ "Using a " + useExpr.getArrayOffset().getType() + " to access the array $@ of size " +
defLine.getArraySize() + ".", var, var.getName()
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.c b/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.c
new file mode 100644
index 00000000000..63cd5488f44
--- /dev/null
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.c
@@ -0,0 +1,19 @@
+
+int main(int argc, char** argv) {
+ char *filePath = argv[2];
+
+ {
+ // BAD: the user-controlled string is injected
+ // directly into `wordexp` which performs command substitution
+
+ wordexp_t we;
+ wordexp(filePath, &we, 0);
+ }
+
+ {
+ // GOOD: command substitution is disabled
+
+ wordexp_t we;
+ wordexp(filePath, &we, WRDE_NOCMD);
+ }
+}
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.qhelp b/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.qhelp
new file mode 100644
index 00000000000..6dd9662c57d
--- /dev/null
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.qhelp
@@ -0,0 +1,42 @@
+
+
+
+The code passes user input to wordexp. This leaves the code
+vulnerable to attack by command injection, because wordexp performs command substitution.
+Command substitution is a feature that replaces $(command) or `command` with the
+output of the given command, allowing the user to run arbitrary code on the system.
+
+
+
+
+
+When calling wordexp, pass the WRDE_NOCMD flag to prevent command substitution.
+
+
+
+The following example passes a user-supplied file path to wordexp in two ways. The
+first way uses wordexp with no specified flags. As such, it is vulnerable to command
+injection.
+The second way uses wordexp with the WRDE_NOCMD flag. As such, no command substitution
+is performed, making this safe from command injection.
+
+
+
+
+
+CERT C Coding Standard:
+STR02-C.
+Sanitize data passed to complex subsystems.
+
+OWASP:
+Command Injection.
+
+
+
+
+
+
+
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.ql b/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.ql
new file mode 100644
index 00000000000..40b61ff60f6
--- /dev/null
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.ql
@@ -0,0 +1,57 @@
+/**
+ * @name Uncontrolled data used in `wordexp` command
+ * @description Using user-supplied data in a `wordexp` command, without
+ * disabling command substitution, can make code vulnerable
+ * to command injection.
+ * @kind path-problem
+ * @problem.severity error
+ * @precision high
+ * @id cpp/wordexp-injection
+ * @tags security
+ * external/cwe/cwe-078
+ */
+
+import cpp
+import semmle.code.cpp.ir.dataflow.TaintTracking
+import semmle.code.cpp.security.FlowSources
+import DataFlow::PathGraph
+
+/**
+ * The `wordexp` function, which can perform command substitution.
+ */
+private class WordexpFunction extends Function {
+ WordexpFunction() { hasGlobalName("wordexp") }
+}
+
+/**
+ * Holds if `fc` disables command substitution by containing `WRDE_NOCMD` as a flag argument.
+ */
+private predicate isCommandSubstitutionDisabled(FunctionCall fc) {
+ fc.getArgument(2).getValue().toInt().bitAnd(4) = 4
+ /* 4 = WRDE_NOCMD. Check whether the flag is set. */
+}
+
+/**
+ * A configuration to track user-supplied data to the `wordexp` function.
+ */
+class WordexpTaintConfiguration extends TaintTracking::Configuration {
+ WordexpTaintConfiguration() { this = "WordexpTaintConfiguration" }
+
+ override predicate isSource(DataFlow::Node source) { source instanceof FlowSource }
+
+ override predicate isSink(DataFlow::Node sink) {
+ exists(FunctionCall fc | fc.getTarget() instanceof WordexpFunction |
+ fc.getArgument(0) = sink.asExpr() and
+ not isCommandSubstitutionDisabled(fc)
+ )
+ }
+
+ override predicate isSanitizer(DataFlow::Node node) {
+ node.asExpr().getUnspecifiedType() instanceof IntegralType
+ }
+}
+
+from WordexpTaintConfiguration conf, DataFlow::PathNode sourceNode, DataFlow::PathNode sinkNode
+where conf.hasFlowPath(sourceNode, sinkNode)
+select sinkNode.getNode(), sourceNode, sinkNode,
+ "Using user-supplied data in a `wordexp` command, without disabling command substitution, can make code vulnerable to command injection."
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.cpp b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.cpp
new file mode 100644
index 00000000000..408ae2d5e53
--- /dev/null
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.cpp
@@ -0,0 +1,17 @@
+#define MAX_SIZE 1024
+
+struct FixedArray {
+ int buf[MAX_SIZE];
+};
+
+int main(){
+ FixedArray arr;
+
+ for(int i = 0; i <= MAX_SIZE; i++) {
+ arr.buf[i] = 0; // BAD
+ }
+
+ for(int i = 0; i < MAX_SIZE; i++) {
+ arr.buf[i] = 0; // GOOD
+ }
+}
\ No newline at end of file
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.qhelp b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.qhelp
new file mode 100644
index 00000000000..c9e2673f079
--- /dev/null
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.qhelp
@@ -0,0 +1,29 @@
+
+
+
+The program performs an out-of-bounds read or write operation. In addition to causing program instability, techniques exist which may allow an attacker to use this vulnerability to execute arbitrary code.
+
+
+
+
+Ensure that pointer dereferences are properly guarded to ensure that they cannot be used to read or write past the end of the allocation.
+
+
+
+The first example uses a for loop which is improperly bounded by a non-strict less-than operation and will write one position past the end of the array. The second example bounds the for loop properly with a strict less-than operation.
+
+
+
+
+
+CERT C Coding Standard:
+ARR30-C. Do not form or use out-of-bounds pointers or array subscripts.
+
+OWASP:
+Buffer Overflow.
+
+
+
+
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql
new file mode 100644
index 00000000000..990c4356425
--- /dev/null
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql
@@ -0,0 +1,107 @@
+/**
+ * @name Constant array overflow
+ * @description Dereferencing a pointer that points past a statically-sized array is undefined behavior
+ * and may lead to security vulnerabilities
+ * @kind path-problem
+ * @problem.severity error
+ * @id cpp/constant-array-overflow
+ * @tags reliability
+ * security
+ */
+
+import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysis
+import experimental.semmle.code.cpp.semantic.SemanticBound
+import experimental.semmle.code.cpp.semantic.SemanticExprSpecific
+import semmle.code.cpp.ir.IR
+import experimental.semmle.code.cpp.ir.dataflow.DataFlow
+import experimental.semmle.code.cpp.ir.dataflow.DataFlow2
+import DataFlow2::PathGraph
+
+pragma[nomagic]
+Instruction getABoundIn(SemBound b, IRFunction func) {
+ result = b.getExpr(0) and
+ result.getEnclosingIRFunction() = func
+}
+
+/**
+ * Holds if `i <= b + delta`.
+ */
+pragma[nomagic]
+predicate bounded(Instruction i, Instruction b, int delta) {
+ exists(SemBound bound, IRFunction func |
+ semBounded(getSemanticExpr(i), bound, delta, true, _) and
+ b = getABoundIn(bound, func) and
+ i.getEnclosingIRFunction() = func
+ )
+}
+
+class FieldAddressToPointerArithmeticConf extends DataFlow::Configuration {
+ FieldAddressToPointerArithmeticConf() { this = "FieldAddressToPointerArithmeticConf" }
+
+ override predicate isSource(DataFlow::Node source) { isFieldAddressSource(_, source) }
+
+ override predicate isSink(DataFlow::Node sink) {
+ exists(PointerAddInstruction pai | pai.getLeft() = sink.asInstruction())
+ }
+}
+
+predicate isFieldAddressSource(Field f, DataFlow::Node source) {
+ source.asInstruction().(FieldAddressInstruction).getField() = f
+}
+
+/**
+ * Holds if `sink` is a sink for `InvalidPointerToDerefConf` and `i` is a `StoreInstruction` that
+ * writes to an address that non-strictly upper-bounds `sink`, or `i` is a `LoadInstruction` that
+ * reads from an address that non-strictly upper-bounds `sink`.
+ */
+predicate isInvalidPointerDerefSink(DataFlow::Node sink, Instruction i, string operation) {
+ exists(AddressOperand addr, int delta |
+ bounded(addr.getDef(), sink.asInstruction(), delta) and
+ delta >= 0 and
+ i.getAnOperand() = addr
+ |
+ i instanceof StoreInstruction and
+ operation = "write"
+ or
+ i instanceof LoadInstruction and
+ operation = "read"
+ )
+}
+
+predicate isConstantSizeOverflowSource(Field f, PointerAddInstruction pai, int delta) {
+ exists(
+ int size, int bound, FieldAddressToPointerArithmeticConf conf, DataFlow::Node source,
+ DataFlow::InstructionNode sink
+ |
+ conf.hasFlow(source, sink) and
+ isFieldAddressSource(f, source) and
+ pai.getLeft() = sink.asInstruction() and
+ f.getUnspecifiedType().(ArrayType).getArraySize() = size and
+ semBounded(getSemanticExpr(pai.getRight()), any(SemZeroBound b), bound, true, _) and
+ delta = bound - size and
+ delta >= 0 and
+ size != 0 and
+ size != 1
+ )
+}
+
+class PointerArithmeticToDerefConf extends DataFlow2::Configuration {
+ PointerArithmeticToDerefConf() { this = "PointerArithmeticToDerefConf" }
+
+ override predicate isSource(DataFlow::Node source) {
+ isConstantSizeOverflowSource(_, source.asInstruction(), _)
+ }
+
+ override predicate isSink(DataFlow::Node sink) { isInvalidPointerDerefSink(sink, _, _) }
+}
+
+from
+ Field f, DataFlow2::PathNode source, DataFlow2::PathNode sink, Instruction deref,
+ PointerArithmeticToDerefConf conf, string operation, int delta
+where
+ conf.hasFlowPath(source, sink) and
+ isInvalidPointerDerefSink(sink.getNode(), deref, operation) and
+ isConstantSizeOverflowSource(f, source.getNode().asInstruction(), delta)
+select source, source, sink,
+ "This pointer arithmetic may have an off-by-" + (delta + 1) +
+ " error allowing it to overrun $@ at this $@.", f, f.getName(), deref, operation
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql b/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql
index 71bcbfaf2ee..d2593dd05a0 100644
--- a/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql
@@ -76,7 +76,7 @@ private predicate hasSizeImpl(Expr e, DataFlow::Node n, string state) {
* Holds if `(n, state)` pair represents the source of flow for the size
* expression associated with `alloc`.
*/
-predicate hasSize(AllocationExpr alloc, DataFlow::Node n, string state) {
+predicate hasSize(HeuristicAllocationExpr alloc, DataFlow::Node n, string state) {
hasSizeImpl(alloc.getSizeExpr(), n, state)
}
@@ -132,6 +132,8 @@ class AllocToInvalidPointerConf extends ProductFlow::Configuration {
override predicate isBarrierOut2(DataFlow::Node node) {
node = any(DataFlow::SsaPhiNode phi).getAnInput(true)
}
+
+ override predicate isBarrierIn1(DataFlow::Node node) { this.isSourcePair(node, _, _, _) }
}
pragma[nomagic]
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-273/PrivilegeDroppingOutoforder.ql b/cpp/ql/src/experimental/Security/CWE/CWE-273/PrivilegeDroppingOutoforder.ql
index 3c079728bcc..0491d711833 100644
--- a/cpp/ql/src/experimental/Security/CWE/CWE-273/PrivilegeDroppingOutoforder.ql
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-273/PrivilegeDroppingOutoforder.ql
@@ -1,7 +1,7 @@
/**
* @name LinuxPrivilegeDroppingOutoforder
* @description A syscall commonly associated with privilege dropping is being called out of order.
- * Normally a process drops group ID and sets supplimental groups for the target user
+ * Normally a process drops group ID and sets supplemental groups for the target user
* before setting the target user ID. This can have security impact if the return code
* from these methods is not checked.
* @kind problem
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-362/double-fetch.ql b/cpp/ql/src/experimental/Security/CWE/CWE-362/double-fetch.ql
index 7169f3bead3..39ab8c1ead4 100644
--- a/cpp/ql/src/experimental/Security/CWE/CWE-362/double-fetch.ql
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-362/double-fetch.ql
@@ -2,7 +2,7 @@
* @name Linux kernel double-fetch vulnerability detection
* @description Double-fetch is a very common vulnerability pattern
* in linux kernel, attacker can exploit double-fetch
- * issues to obatain root privilege.
+ * issues to obtain root privilege.
* Double-fetch is caused by fetching data from user
* mode by calling copy_from_user twice, CVE-2016-6480
* is quite a good example for your information.
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-561/FindIncorrectlyUsedSwitch.ql b/cpp/ql/src/experimental/Security/CWE/CWE-561/FindIncorrectlyUsedSwitch.ql
index 7fc26e54ae9..2de9cf5fc78 100644
--- a/cpp/ql/src/experimental/Security/CWE/CWE-561/FindIncorrectlyUsedSwitch.ql
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-561/FindIncorrectlyUsedSwitch.ql
@@ -84,7 +84,7 @@ predicate isConditionBig(SwitchStmt swtmp) {
}
/** Holds if there are labels inside the block with names similar to `default` or `case`. */
-predicate isWrongLableName(SwitchStmt swtmp) {
+predicate isWrongLabelName(SwitchStmt swtmp) {
not swtmp.hasDefaultCase() and
exists(LabelStmt lb |
(
@@ -147,7 +147,7 @@ where
isConditionBig(sw) and msg = "The range of condition values is wider than the choices."
)
or
- isWrongLableName(sw) and msg = "Possibly erroneous label name."
+ isWrongLabelName(sw) and msg = "Possibly erroneous label name."
or
isCodeBeforeCase(sw) and msg = "Code before case will not be executed."
select sw, msg
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.ql b/cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.ql
index a88cd107b33..97c1e410066 100644
--- a/cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.ql
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.ql
@@ -24,7 +24,7 @@ where
texp.getEnclosingStmt().getParentStmt*() = ts.getStmt() and
not ts.getACatchClause().isEmpty()
) and
- msg = "DllMain contains an exeption not wrapped in a try..catch block."
+ msg = "DllMain contains an exception not wrapped in a try..catch block."
or
texp.getExpr().isParenthesised() and
texp.getExpr().(CommaExpr).getLeftOperand().isConstant() and
diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-754/ImproperCheckReturnValueScanf.qhelp b/cpp/ql/src/experimental/Security/CWE/CWE-754/ImproperCheckReturnValueScanf.qhelp
index ab40910f5d3..69402cc08ae 100644
--- a/cpp/ql/src/experimental/Security/CWE/CWE-754/ImproperCheckReturnValueScanf.qhelp
+++ b/cpp/ql/src/experimental/Security/CWE/CWE-754/ImproperCheckReturnValueScanf.qhelp
@@ -12,7 +12,7 @@ The user should check the return value of `scanf` and related functions and chec
-The first first example below is correct, as value of `i` is only read once it is checked that `scanf` has read one item. The second example is incorrect, as the return value of `scanf` is not checked, and as `scanf` might have failed to read any item before returning.
+The first example below is correct, as value of `i` is only read once it is checked that `scanf` has read one item. The second example is incorrect, as the return value of `scanf` is not checked, and as `scanf` might have failed to read any item before returning.
diff --git a/cpp/ql/src/external/CodeDuplication.qll b/cpp/ql/src/external/CodeDuplication.qll
index e50323f7087..be2dc162e74 100644
--- a/cpp/ql/src/external/CodeDuplication.qll
+++ b/cpp/ql/src/external/CodeDuplication.qll
@@ -292,7 +292,7 @@ deprecated predicate duplicateFiles(File f, File other, int percent) {
}
/**
- * DEPRECATED: Information on duplciate classes is no longer available.
+ * DEPRECATED: Information on duplicate classes is no longer available.
*
* Holds if most member functions of `c` (`numDup` out of `total`) are
* duplicates of member functions in `other`.
@@ -313,7 +313,7 @@ deprecated predicate mostlyDuplicateClassBase(Class c, Class other, int numDup,
}
/**
- * DEPRECATED: Information on duplciate classes is no longer available.
+ * DEPRECATED: Information on duplicate classes is no longer available.
*
* Holds if most member functions of `c` are duplicates of member functions in
* `other`. Provides the human-readable `message` to describe the amount of
diff --git a/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.qhelp b/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.qhelp
index 771d7e23e52..bc51714ec69 100644
--- a/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.qhelp
+++ b/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.qhelp
@@ -5,12 +5,12 @@
Some header files, such as those which define structures or classes, cannot be included more than once within a translation unit, as doing so would
-cause a redefinition error. Such headers must be guarded to prevent ill-effects from multiple inclusion. Simlarly, if header files include other
+cause a redefinition error. Such headers must be guarded to prevent ill-effects from multiple inclusion. Similarly, if header files include other
header files, and this inclusion graph contains a cycle, then at least one file within the cycle must contain header guards in order to break the
cycle. Because of cases like these, all headers should be guarded as a matter of good practice, even if they do not strictly need to be.
-Furthermore, most modern compilers contain optimisations which are triggered by header guards. If the header guard strictly conforms to the pattern
+Furthermore, most modern compilers contain optimizations which are triggered by header guards. If the header guard strictly conforms to the pattern
that compilers expect, then inclusions of that header other than the first have absolutely no effect: the file isn't re-read from disk, nor is it
re-tokenised or re-preprocessed. This can result in a noticeable, albeit minor, improvement to compilation time.
diff --git a/cpp/ql/src/jsf/4.13 Functions/AV Rule 119.ql b/cpp/ql/src/jsf/4.13 Functions/AV Rule 119.ql
index 5eef707432e..0192041dfe8 100644
--- a/cpp/ql/src/jsf/4.13 Functions/AV Rule 119.ql
+++ b/cpp/ql/src/jsf/4.13 Functions/AV Rule 119.ql
@@ -14,4 +14,4 @@ from Function f
where
f.fromSource() and
f.calls+(f)
-select f, "Functions shall not call theselves, either directly or indirectly."
+select f, "Functions shall not call themselves, either directly or indirectly."
diff --git a/cpp/ql/src/jsf/4.21 Operators/AV Rule 160.ql b/cpp/ql/src/jsf/4.21 Operators/AV Rule 160.ql
index 068715dbf8f..6f22e04b9e9 100644
--- a/cpp/ql/src/jsf/4.21 Operators/AV Rule 160.ql
+++ b/cpp/ql/src/jsf/4.21 Operators/AV Rule 160.ql
@@ -41,4 +41,4 @@ where
not ae.getParent() instanceof ExprStmt and
not ae instanceof ForStmtSideEffectExpr
select ae,
- "AV Rule 160: An assignment expression shall be used only as the exprression in an expression statement."
+ "AV Rule 160: An assignment expression shall be used only as the expression in an expression statement."
diff --git a/cpp/ql/src/qlpack.yml b/cpp/ql/src/qlpack.yml
index 12c12ffe83e..169ac0a41ee 100644
--- a/cpp/ql/src/qlpack.yml
+++ b/cpp/ql/src/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/cpp-queries
-version: 0.4.1-dev
+version: 0.4.2-dev
groups:
- cpp
- queries
diff --git a/cpp/ql/test/examples/BadLocking/LocalVariableHidesGlobalVariable.expected b/cpp/ql/test/examples/BadLocking/LocalVariableHidesGlobalVariable.expected
index 4aaecc3b3bd..531452ba1b4 100644
--- a/cpp/ql/test/examples/BadLocking/LocalVariableHidesGlobalVariable.expected
+++ b/cpp/ql/test/examples/BadLocking/LocalVariableHidesGlobalVariable.expected
@@ -1 +1 @@
-| UnintendedDeclaration.cpp:65:14:65:20 | definition of myMutex | Local variable myMutex hides $@ with the same name. | UnintendedDeclaration.cpp:40:7:40:13 | myMutex | a global variable |
+| UnintendedDeclaration.cpp:65:14:65:20 | definition of myMutex | Local variable myMutex hides a $@ with the same name. | UnintendedDeclaration.cpp:40:7:40:13 | myMutex | global variable |
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/WordexpTainted.expected b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/WordexpTainted.expected
new file mode 100644
index 00000000000..a8d7a480c81
--- /dev/null
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/WordexpTainted.expected
@@ -0,0 +1,11 @@
+edges
+| test.cpp:23:20:23:23 | argv | test.cpp:29:13:29:20 | (const char *)... |
+| test.cpp:23:20:23:23 | argv | test.cpp:29:13:29:20 | filePath |
+nodes
+| test.cpp:23:20:23:23 | argv | semmle.label | argv |
+| test.cpp:29:13:29:20 | (const char *)... | semmle.label | (const char *)... |
+| test.cpp:29:13:29:20 | filePath | semmle.label | filePath |
+subpaths
+#select
+| test.cpp:29:13:29:20 | (const char *)... | test.cpp:23:20:23:23 | argv | test.cpp:29:13:29:20 | (const char *)... | Using user-supplied data in a `wordexp` command, without disabling command substitution, can make code vulnerable to command injection. |
+| test.cpp:29:13:29:20 | filePath | test.cpp:23:20:23:23 | argv | test.cpp:29:13:29:20 | filePath | Using user-supplied data in a `wordexp` command, without disabling command substitution, can make code vulnerable to command injection. |
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/WordexpTainted.qlref b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/WordexpTainted.qlref
new file mode 100644
index 00000000000..ecff539f3e6
--- /dev/null
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/WordexpTainted.qlref
@@ -0,0 +1 @@
+experimental/Security/CWE/CWE-078/WordexpTainted.ql
\ No newline at end of file
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/test.cpp b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/test.cpp
new file mode 100644
index 00000000000..0ae98b8f163
--- /dev/null
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-078/test.cpp
@@ -0,0 +1,45 @@
+#ifdef _MSC_VER
+#define restrict __restrict
+#else
+#define restrict __restrict__
+#endif
+
+typedef unsigned long size_t;
+
+typedef struct {
+ size_t we_wordc;
+ char **we_wordv;
+ size_t we_offs;
+} wordexp_t;
+
+enum {
+ WRDE_APPEND = (1 << 1),
+ WRDE_NOCMD = (1 << 2)
+};
+
+int wordexp(const char *restrict s, wordexp_t *restrict p, int flags);
+
+int main(int argc, char** argv) {
+ char *filePath = argv[2];
+
+ {
+ // BAD: the user string is injected directly into `wordexp` which performs command substitution
+
+ wordexp_t we;
+ wordexp(filePath, &we, 0);
+ }
+
+ {
+ // GOOD: command substitution is disabled
+
+ wordexp_t we;
+ wordexp(filePath, &we, WRDE_NOCMD);
+ }
+
+ {
+ // GOOD: command substitution is disabled
+
+ wordexp_t we;
+ wordexp(filePath, &we, WRDE_NOCMD | WRDE_APPEND);
+ }
+}
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected
new file mode 100644
index 00000000000..9d68450439e
--- /dev/null
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected
@@ -0,0 +1,37 @@
+edges
+| test.cpp:66:32:66:32 | p | test.cpp:66:32:66:32 | Load |
+| test.cpp:66:32:66:32 | p | test.cpp:67:5:67:6 | * ... |
+| test.cpp:66:32:66:32 | p | test.cpp:67:6:67:6 | Load |
+| test.cpp:77:26:77:44 | & ... | test.cpp:66:32:66:32 | p |
+| test.cpp:77:26:77:44 | & ... | test.cpp:66:32:66:32 | p |
+| test.cpp:77:27:77:44 | access to array | test.cpp:77:26:77:44 | & ... |
+nodes
+| test.cpp:35:5:35:22 | access to array | semmle.label | access to array |
+| test.cpp:36:5:36:24 | access to array | semmle.label | access to array |
+| test.cpp:43:9:43:19 | access to array | semmle.label | access to array |
+| test.cpp:49:5:49:22 | access to array | semmle.label | access to array |
+| test.cpp:50:5:50:24 | access to array | semmle.label | access to array |
+| test.cpp:57:9:57:19 | access to array | semmle.label | access to array |
+| test.cpp:61:9:61:19 | access to array | semmle.label | access to array |
+| test.cpp:66:32:66:32 | Load | semmle.label | Load |
+| test.cpp:66:32:66:32 | p | semmle.label | p |
+| test.cpp:66:32:66:32 | p | semmle.label | p |
+| test.cpp:67:5:67:6 | * ... | semmle.label | * ... |
+| test.cpp:67:6:67:6 | Load | semmle.label | Load |
+| test.cpp:72:5:72:15 | access to array | semmle.label | access to array |
+| test.cpp:77:26:77:44 | & ... | semmle.label | & ... |
+| test.cpp:77:27:77:44 | access to array | semmle.label | access to array |
+subpaths
+#select
+| test.cpp:35:5:35:22 | access to array | test.cpp:35:5:35:22 | access to array | test.cpp:35:5:35:22 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:35:5:35:26 | Store: ... = ... | write |
+| test.cpp:36:5:36:24 | access to array | test.cpp:36:5:36:24 | access to array | test.cpp:36:5:36:24 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:36:5:36:28 | Store: ... = ... | write |
+| test.cpp:43:9:43:19 | access to array | test.cpp:43:9:43:19 | access to array | test.cpp:43:9:43:19 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:43:9:43:23 | Store: ... = ... | write |
+| test.cpp:49:5:49:22 | access to array | test.cpp:49:5:49:22 | access to array | test.cpp:49:5:49:22 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:49:5:49:26 | Store: ... = ... | write |
+| test.cpp:50:5:50:24 | access to array | test.cpp:50:5:50:24 | access to array | test.cpp:50:5:50:24 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:50:5:50:28 | Store: ... = ... | write |
+| test.cpp:57:9:57:19 | access to array | test.cpp:57:9:57:19 | access to array | test.cpp:57:9:57:19 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:57:9:57:23 | Store: ... = ... | write |
+| test.cpp:61:9:61:19 | access to array | test.cpp:61:9:61:19 | access to array | test.cpp:61:9:61:19 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:61:9:61:23 | Store: ... = ... | write |
+| test.cpp:72:5:72:15 | access to array | test.cpp:72:5:72:15 | access to array | test.cpp:72:5:72:15 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:72:5:72:19 | Store: ... = ... | write |
+| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:66:32:66:32 | Load | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write |
+| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:66:32:66:32 | p | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write |
+| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:67:5:67:6 | * ... | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write |
+| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:67:6:67:6 | Load | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write |
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.qlref b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.qlref
new file mode 100644
index 00000000000..082e8951c70
--- /dev/null
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.qlref
@@ -0,0 +1 @@
+experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/test.cpp b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/test.cpp
new file mode 100644
index 00000000000..df4cd7b4491
--- /dev/null
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/test.cpp
@@ -0,0 +1,80 @@
+#define MAX_SIZE 1024
+
+struct ZeroArray {
+ int size;
+ int buf[0];
+};
+
+struct OneArray {
+ int size;
+ int buf[1];
+};
+
+struct BigArray {
+ int size;
+ int buf[MAX_SIZE];
+};
+
+struct ArrayAndFields {
+ int buf[MAX_SIZE];
+ int field1;
+ int field2;
+};
+
+// tests for dynamic-size trailing arrays
+void testZeroArray(ZeroArray *arr) {
+ arr->buf[0] = 0;
+}
+
+void testOneArray(OneArray *arr) {
+ arr->buf[1] = 0;
+}
+
+void testBig(BigArray *arr) {
+ arr->buf[MAX_SIZE-1] = 0; // GOOD
+ arr->buf[MAX_SIZE] = 0; // BAD
+ arr->buf[MAX_SIZE+1] = 0; // BAD
+
+ for(int i = 0; i < MAX_SIZE; i++) {
+ arr->buf[i] = 0; // GOOD
+ }
+
+ for(int i = 0; i <= MAX_SIZE; i++) {
+ arr->buf[i] = 0; // BAD
+ }
+}
+
+void testFields(ArrayAndFields *arr) {
+ arr->buf[MAX_SIZE-1] = 0; // GOOD
+ arr->buf[MAX_SIZE] = 0; // BAD?
+ arr->buf[MAX_SIZE+1] = 0; // BAD?
+
+ for(int i = 0; i < MAX_SIZE; i++) {
+ arr->buf[i] = 0; // GOOD
+ }
+
+ for(int i = 0; i <= MAX_SIZE; i++) {
+ arr->buf[i] = 0; // BAD?
+ }
+
+ for(int i = 0; i < MAX_SIZE+2; i++) {
+ arr->buf[i] = 0; // BAD?
+ }
+ // is this different if it's a memcpy?
+}
+
+void assignThroughPointer(int *p) {
+ *p = 0; // ??? should the result go at a flow source?
+}
+
+void addToPointerAndAssign(int *p) {
+ p[MAX_SIZE-1] = 0; // GOOD
+ p[MAX_SIZE] = 0; // BAD
+}
+
+void testInterproc(BigArray *arr) {
+ assignThroughPointer(&arr->buf[MAX_SIZE-1]); // GOOD
+ assignThroughPointer(&arr->buf[MAX_SIZE]); // BAD
+
+ addToPointerAndAssign(arr->buf);
+}
diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/FindIncorrectlyUsedExceptions.expected b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/FindIncorrectlyUsedExceptions.expected
index af032eb387e..3bb6a86801f 100644
--- a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/FindIncorrectlyUsedExceptions.expected
+++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/FindIncorrectlyUsedExceptions.expected
@@ -1,3 +1,3 @@
| test.cpp:35:3:35:33 | call to runtime_error | Object creation of exception type on stack. Did you forget the throw keyword? |
| test.cpp:41:3:41:11 | call to funcTest1 | There is an exception in the function that requires your attention. |
-| test.cpp:42:3:42:9 | call to DllMain | DllMain contains an exeption not wrapped in a try..catch block. |
+| test.cpp:42:3:42:9 | call to DllMain | DllMain contains an exception not wrapped in a try..catch block. |
diff --git a/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql b/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql
index e8eb7a4a217..d3e44c868cf 100644
--- a/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql
+++ b/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql
@@ -17,7 +17,7 @@ class RangeAnalysisTest extends InlineExpectationsTest {
tag = "range" and
element = e.toString() and
location = e.getLocation() and
- value = getARangeString(e)
+ value = quote(getARangeString(e))
)
}
}
@@ -33,6 +33,9 @@ private string getOffsetString(int value) {
if value >= 0 then result = "+" + value.toString() else result = value.toString()
}
+bindingset[s]
+string quote(string s) { if s.matches("% %") then result = "\"" + s + "\"" else result = s }
+
bindingset[delta]
private string getBoundString(SemBound b, int delta) {
b instanceof SemZeroBound and result = delta.toString()
diff --git a/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp b/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp
new file mode 100644
index 00000000000..38eaeab3b12
--- /dev/null
+++ b/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp
@@ -0,0 +1,999 @@
+#include "test_util.h"
+
+struct List {
+ struct List* next;
+};
+
+int test1(struct List* p) {
+ int count = 0;
+ for (; p; p = p->next) {
+ count = count+1;
+ range(count); // $ range===count:p+1 range=>=1
+ }
+ range(count); // $ range=>=0
+ return count;
+}
+
+int test2(struct List* p) {
+ int count = 0;
+ for (; p; p = p->next) {
+ count = (count+1) % 10;
+ range(count); // $ range=<=9
+ }
+ range(count); // $ range=<=9
+ return count;
+}
+
+int test3(struct List* p) {
+ int count = 0;
+ for (; p; p = p->next) {
+ range(count++); // $ range=<=9
+ count = count % 10;
+ range(count); // $ range=<=9
+ }
+ range(count); // $ range=<=9
+ return count;
+}
+
+int test4() {
+ int i = 0;
+ int total = 0;
+ for (i = 0; i < 2; i = i+1) {
+ range(i); // $ range=<=1 range=>=0
+ range(total);
+ total += i;
+ range(total);
+ }
+ range(total);
+ range(i); // $ range===2
+ range(total + i); // $ range=>=i+1
+ return total + i;
+}
+
+int test5() {
+ int i = 0;
+ int total = 0;
+ for (i = 0; i < 2; i++) {
+ range(i); // $ range=<=1 range=>=0
+ range(total);
+ total += i;
+ range(total);
+ }
+ range(total);
+ range(i); // $ range===2
+ range(total + i); // $ range=>=i+1
+ return total + i;
+}
+
+int test6() {
+ int i = 0;
+ int total = 0;
+ for (i = 0; i+2 < 4; i = i+1) {
+ range(i); // $ range=<=1 range=>=0
+ range(total);
+ total += i;
+ range(total);
+ }
+ return total + i;
+}
+
+int test7(int i) {
+ if (i < 4) {
+ if (i < 5) {
+ range(i); // $ range=<=3
+ return i;
+ }
+ range(i); // $ range=<=3 range=>=5
+ }
+ range(i);
+ return 1;
+}
+
+int test8(int x, int y) {
+ if (-1000 < y && y < 10) {
+ range(y); // $ range=<=9 range=>=-999
+ if (x < y-2) {
+ range(x); // $ range=<=6 range=<=y-3
+ range(y); // $ range=<=9 range=>=-999 range=>=x+3
+ return x;
+ }
+ range(x); // $ range=>=-1001 range=>=y-2
+ range(y); // $ range=<=9 range=<=x+2 range=>=-999
+ }
+ range(x);
+ range(y);
+ return y;
+}
+
+int test9(int x, int y) {
+ if (y == 0) {
+ if (x < 4) {
+ range(x); // $ range=<=3
+ return 0;
+ }
+ range(x); // $ range=>=4
+ } else {
+ if (x < 4) {
+ range(x); // $ range=<=3
+ return 1;
+ }
+ range(x); // $ range=>=4
+ }
+ return x;
+}
+
+int test10(int x, int y) {
+ if (y > 7) {
+ range(y); // $ range=>=8
+ if (x < y) {
+ range(x); // $ range=<=y-1
+ range(y); // $ range=>=8 range=>=x+1
+ return 0;
+ }
+ range(x); // $ range=>=8 range=>=y+0
+ range(y); // $ range=<=x+0 range=>=8
+ return x;
+ }
+ range(y); // $ range=<=7
+ return 1;
+}
+
+int test11(char *p) {
+ char c;
+ c = *p;
+ range(*p);
+ if (c != '\0') {
+ *p++ = '\0';
+ range(p); // $ range===p+1
+ range(*p);
+ }
+ if (c == ':') {
+ range(c);
+ c = *p;
+ range(*p);
+ if (c != '\0') {
+ range(c);
+ *p++ = '\0';
+ range(p); // $ range=<=p+2 range===c+1 range=>=p+1
+ }
+ if (c != ',') {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+typedef unsigned long long size_type;
+
+size_type test12_helper() {
+ static size_type n = 0;
+ return n++;
+}
+
+int test12() {
+ size_type Start = 0;
+ while (Start <= test12_helper()-1)
+ {
+ range(Start); // $ range=>=0
+ const size_type Length = test12_helper();
+ Start += Length + 1;
+ range(Start); // $ range=>=1 range=>=Start+1 range=">=call to test12_helper+1"
+ }
+ range(Start); // $ range=>=0
+
+ return 1;
+}
+
+// Tests for overflow conditions.
+int test13(char c, int i) {
+ unsigned char uc = c;
+ range(uc);
+ unsigned int x = 0;
+ unsigned int y = x-1;
+ range(y); // $ range===-1
+ int z = i+1;
+ range(z); // $ range===i+1
+ range(c + i + uc + x + y + z); // $ range=>=1 range=">=... - ...+0"
+ range((double)(c + i + uc + x + y + z)); // $ range=>=1 range=">=... - ...+0"
+ return (double)(c + i + uc + x + y + z);
+}
+
+// Regression test for ODASA-6013.
+int test14(int x) {
+ int x0 = (int)(char)x;
+ range(x0);
+ int x1 = (int)(unsigned char)x;
+ range(x1);
+ int x2 = (int)(unsigned short)x;
+ range(x2);
+ int x3 = (int)(unsigned int)x;
+ range(x3);
+ char c0 = x;
+ range(c0);
+ unsigned short s0 = x;
+ range(s0);
+ range(x0 + x1 + x2 + x3 + c0 + s0);
+ return x0 + x1 + x2 + x3 + c0 + s0;
+}
+
+long long test15(long long x) {
+ return (x > 0 && (range(x), x == (int)x)) ? // $ range=>=1
+ (range(x), x) : // $ range=>=1
+ (range(x), -1);
+}
+
+// Tests for unary operators.
+int test_unary(int a) {
+ int total = 0;
+
+ if (3 <= a && a <= 11) {
+ range(a); // $ range=<=11 range=>=3
+ int b = +a;
+ range(b); // $ range=<=11 range=>=3
+ int c = -a;
+ range(c);
+ range(b+c); // $ range=<=10 range="<=+ ...:a-1" range=">=- ...+1"
+ total += b+c;
+ range(total);
+ }
+ if (0 <= a && a <= 11) {
+ range(a); // $ range=<=11 range=>=0
+ int b = +a;
+ range(b); // $ range=<=11 range=>=0
+ int c = -a;
+ range(c);
+ range(b+c); // $ range=<=11 range="<=+ ...:a+0" range=">=- ...+0"
+ total += b+c;
+ range(total);
+ }
+ if (-7 <= a && a <= 11) {
+ range(a); // $ range=<=11 range=>=-7
+ int b = +a;
+ range(b); // $ range=<=11 range=>=-7
+ int c = -a;
+ range(c);
+ range(b+c);
+ total += b+c;
+ range(total);
+ }
+ if (-7 <= a && a <= 1) {
+ range(a); // $ range=<=1 range=>=-7
+ int b = +a;
+ range(b); // $ range=<=1 range=>=-7
+ int c = -a;
+ range(c);
+ range(b+c);
+ total += b+c;
+ range(total);
+ }
+ if (-7 <= a && a <= 0) {
+ range(a); // $ range=<=0 range=>=-7
+ int b = +a;
+ range(b); // $ range=<=0 range=>=-7
+ int c = -a;
+ range(c);
+ range(b+c); // $ range="<=- ...+0" range=">=+ ...:a+0" range=>=-7
+ total += b+c;
+ range(total);
+ }
+ if (-7 <= a && a <= -2) {
+ range(a); // $ range=<=-2 range=>=-7
+ int b = +a;
+ range(b); // $ range=<=-2 range=>=-7
+ int c = -a;
+ range(c);
+ range(b+c); // $ range="<=- ...-1" range=">=+ ...:a+1" range=>=-6
+ total += b+c;
+ range(total);
+ }
+ range(total);
+ return total;
+}
+
+
+// Tests for multiplication.
+int test_mult01(int a, int b) {
+ int total = 0;
+
+ if (3 <= a && a <= 11 && 5 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=23 range=>=5
+ int r = a*b; // 15 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=>=1
+ }
+ if (3 <= a && a <= 11 && 0 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=23 range=>=0
+ int r = a*b; // 0 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=>=0 range=>=3+0
+ }
+ if (3 <= a && a <= 11 && -13 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=23 range=>=-13
+ int r = a*b; // -143 .. 253
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (3 <= a && a <= 11 && -13 <= b && b <= 0) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=0 range=>=-13
+ int r = a*b; // -143 .. 0
+ range(r);
+ total += r;
+ range(total); // $ range=<=3+0
+ }
+ if (3 <= a && a <= 11 && -13 <= b && b <= -7) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=-7 range=>=-13
+ int r = a*b; // -143 .. -21
+ range(r);
+ total += r;
+ range(total); // $ range=<=3-1
+ }
+ range(total); // $ range=<=3+0
+ return total;
+}
+
+// Tests for multiplication.
+int test_mult02(int a, int b) {
+ int total = 0;
+
+ if (0 <= a && a <= 11 && 5 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=0
+ range(b); // $ range=<=23 range=>=5
+ int r = a*b; // 0 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=>=0
+ }
+ if (0 <= a && a <= 11 && 0 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=0
+ range(b); // $ range=<=23 range=>=0
+ int r = a*b; // 0 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=>=0 range=>=0+0
+ }
+ if (0 <= a && a <= 11 && -13 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=0
+ range(b); // $ range=<=23 range=>=-13
+ int r = a*b; // -143 .. 253
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (0 <= a && a <= 11 && -13 <= b && b <= 0) {
+ range(a); // $ range=<=11 range=>=0
+ range(b); // $ range=<=0 range=>=-13
+ int r = a*b; // -143 .. 0
+ range(r);
+ total += r;
+ range(total); // $ range=<=0+0
+ }
+ if (0 <= a && a <= 11 && -13 <= b && b <= -7) {
+ range(a); // $ range=<=11 range=>=0
+ range(b); // $ range=<=-7 range=>=-13
+ int r = a*b; // -143 .. 0
+ range(r);
+ total += r;
+ range(total); // $ range=<=0+0
+ }
+ range(total); // $ range=<=0+0
+ return total;
+}
+
+// Tests for multiplication.
+int test_mult03(int a, int b) {
+ int total = 0;
+
+ if (-17 <= a && a <= 11 && 5 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=-17
+ range(b); // $ range=<=23 range=>=5
+ int r = a*b; // -391 .. 253
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (-17 <= a && a <= 11 && 0 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=-17
+ range(b); // $ range=<=23 range=>=0
+ int r = a*b; // -391 .. 253
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (-17 <= a && a <= 11 && -13 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=-17
+ range(b); // $ range=<=23 range=>=-13
+ int r = a*b; // -391 .. 253
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (-17 <= a && a <= 11 && -13 <= b && b <= 0) {
+ range(a); // $ range=<=11 range=>=-17
+ range(b); // $ range=<=0 range=>=-13
+ int r = a*b; // -143 .. 221
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (-17 <= a && a <= 11 && -13 <= b && b <= -7) {
+ range(a); // $ range=<=11 range=>=-17
+ range(b); // $ range=<=-7 range=>=-13
+ int r = a*b; // -143 .. 221
+ range(r);
+ total += r;
+ range(total);
+ }
+ range(total);
+ return total;
+}
+
+// Tests for multiplication.
+int test_mult04(int a, int b) {
+ int total = 0;
+
+ if (-17 <= a && a <= 0 && 5 <= b && b <= 23) {
+ range(a); // $ range=<=0 range=>=-17
+ range(b); // $ range=<=23 range=>=5
+ int r = a*b; // -391 .. 0
+ total += r;
+ range(total); // $ range=<=0
+ }
+ if (-17 <= a && a <= 0 && 0 <= b && b <= 23) {
+ range(a); // $ range=<=0 range=>=-17
+ range(b); // $ range=<=23 range=>=0
+ int r = a*b; // -391 .. 0
+ range(r);
+ total += r;
+ range(total); // $ range="<=- ...+0" range=<=0
+ }
+ if (-17 <= a && a <= 0 && -13 <= b && b <= 23) {
+ range(a); // $ range=<=0 range=>=-17
+ range(b); // $ range=<=23 range=>=-13
+ int r = a*b; // -391 .. 221
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (-17 <= a && a <= 0 && -13 <= b && b <= 0) {
+ range(a); // $ range=<=0 range=>=-17
+ range(b); // $ range=<=0 range=>=-13
+ int r = a*b; // 0 .. 221
+ range(r);
+ total += r;
+ range(total); // $ range=">=- ...+0"
+ }
+ if (-17 <= a && a <= 0 && -13 <= b && b <= -7) {
+ range(a); // $ range=<=0 range=>=-17
+ range(b); // $ range=<=-7 range=>=-13
+ int r = a*b; // 0 .. 221
+ range(r);
+ total += r;
+ range(total); // $ range=">=- ...+0"
+ }
+ range(total); // $ range=">=- ...+0"
+ return total;
+}
+
+// Tests for multiplication.
+int test_mult05(int a, int b) {
+ int total = 0;
+
+ if (-17 <= a && a <= -2 && 5 <= b && b <= 23) {
+ range(a); // $ range=<=-2 range=>=-17
+ range(b); // $ range=<=23 range=>=5
+ int r = a*b; // -391 .. -10
+ range(r);
+ total += r;
+ range(total); // $ range=<=-1
+ }
+ if (-17 <= a && a <= -2 && 0 <= b && b <= 23) {
+ range(a); // $ range=<=-2 range=>=-17
+ range(b); // $ range=<=23 range=>=0
+ int r = a*b; // -391 .. 0
+ range(r);
+ total += r;
+ range(total); // $ range="<=- ...+0" range=<=0
+ }
+ if (-17 <= a && a <= -2 && -13 <= b && b <= 23) {
+ range(a); // $ range=<=-2 range=>=-17
+ range(b); // $ range=<=23 range=>=-13
+ int r = a*b; // -391 .. 221
+ range(r);
+ total += r;
+ range(total);
+ }
+ if (-17 <= a && a <= -2 && -13 <= b && b <= 0) {
+ range(a); // $ range=<=-2 range=>=-17
+ range(b); // $ range=<=0 range=>=-13
+ int r = a*b; // 0 .. 221
+ range(r);
+ total += r;
+ range(total); // $ range=">=- ...+0"
+ }
+ if (-17 <= a && a <= -2 && -13 <= b && b <= -7) {
+ range(a); // $ range=<=-2 range=>=-17
+ range(b); // $ range=<=-7 range=>=-13
+ int r = a*b; // 14 .. 221
+ range(r);
+ total += r;
+ range(total); // $ range=">=- ...+1"
+ }
+ range(total); // $ range=">=- ...+0"
+ return total;
+}
+
+int test16(int x) {
+ int d, i = 0;
+ if (x < 0) {
+ range(x); // $ range=<=-1
+ return -1;
+ }
+
+ while (i < 3) {
+ range(i); // $ range=<=2 range=>=0
+ i++;
+ range(i); // $ range="==... = ...:i+1" range=<=3 range=>=1
+ }
+ range(d);
+ d = i;
+ range(d); // $ range===3
+ if (x < 0) { // Comparison is always false.
+ range(x); // $ range=<=-1 range=>=0
+ if (d > -x) { // Unreachable code.
+ range(d); // $ range===3
+ range(x); // $ range=<=-1 range=>=0
+ return 1;
+ }
+ range(d); // $ range===3
+ range(x); // $ range=<=-1 range=>=0
+ }
+ range(x); // $ range=>=0
+ return 0;
+}
+
+// Test ternary expression upper bounds.
+unsigned int test_ternary01(unsigned int x) {
+ unsigned int y1, y2, y3, y4, y5, y6, y7, y8;
+ y1 = x < 100 ?
+ (range(x), x) : // $ range=<=99
+ (range(x), 10); // $ range=>=100
+ range(y1);
+ y2 = x >= 100 ?
+ (range(x), 10) : // $ range=>=100
+ (range(x), x); // $ range=<=99
+ range(y2);
+ y3 = 0;
+ y4 = 0;
+ y5 = 0;
+ y6 = 0;
+ y7 = 0;
+ y8 = 0;
+ if (x < 300) {
+ range(x); // $ range=<=299
+ y3 = x ?:
+ (range(x), 5); // y3 < 300
+ range(y3);
+ y4 = x ?:
+ (range(x), 500); // y4 <= 500
+ range(y4);
+ y5 = (x+1) ?:
+ (range(x), 500); // $ range===-1
+ range(y5); // y5 <= 300
+ y6 = ((unsigned char)(x+1)) ?:
+ (range(x), 5); // $ range=<=299
+ range(y6); // y6 < 256
+ y7 = ((unsigned char)(x+1)) ?:
+ (range(x), 500); // $ range=<=299
+ range(y7); // y7 <= 500
+ y8 = ((unsigned short)(x+1)) ?:
+ (range(x), 500); // $ range=<=299
+ range(y8); // y8 <= 300
+ }
+ range(y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8); // $ range=">=... = ...:... ? ... : ...+0" range=">=call to range+0"
+ return y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8;
+}
+
+// Test ternary expression lower bounds.
+unsigned int test_ternary02(unsigned int x) {
+ unsigned int y1, y2, y3, y4, y5;
+ y1 = x > 100 ?
+ (range(x), x) : // $ range=>=101
+ (range(x), 110); // $ range=<=100
+ range(y1); // y1 > 100
+ y2 = x <= 100 ?
+ (range(x), 110) : // $ range=<=100
+ (range(x), x); // $ range=>=101
+ range(y2); // y2 > 100
+ y3 = 1000;
+ y4 = 1000;
+ y5 = 1000;
+ if (x >= 300) {
+ range(x); // $ range=>=300
+ y3 = (x-300) ?:
+ (range(x), 5); // $ range===300
+ range(y3); // y3 >= 0
+ y4 = (x-200) ?:
+ (range(x), 5); // $ range=<=200 range=>=300
+ range(y4); // y4 >= 100
+ y5 = ((unsigned char)(x-200)) ?:
+ (range(x), 5); // $ range=>=300
+ range(y5); // y6 >= 0
+ }
+ range(y1 + y2 + y3 + y4 + y5); // $ range=">=... = ...:... ? ... : ...+0" range=">=call to range+0"
+ return y1 + y2 + y3 + y4 + y5;
+}
+
+// Test the comma expression.
+unsigned int test_comma01(unsigned int x) {
+ unsigned int y = x < 100 ?
+ (range(x), x) : // $ range=<=99
+ (range(x), 100); // $ range=>=100
+ unsigned int y1;
+ unsigned int y2;
+ y1 = (++y, y);
+ range(y1); // $ range="==... ? ... : ...+1"
+ y2 = (y++,
+ range(y), // $ range="==++ ...:... = ...+1" range="==... ? ... : ...+2"
+ y += 3,
+ range(y), // $ range="==++ ...:... = ...+4" range="==... +++3" range="==... ? ... : ...+5"
+ y);
+ range(y2); // $ range="==++ ...:... = ...+4" range="==... +++3" range="==... ? ... : ...+5"
+ range(y1 + y2); // $ range=">=++ ...:... = ...+5" range=">=... +++4" range=">=... += ...:... = ...+1" range=">=... ? ... : ...+6"
+ return y1 + y2;
+}
+
+void test17() {
+ int i, j;
+
+ i = 10;
+ range(i); // $ range===10
+
+ i = 10;
+ i += 10;
+ range(i); // $ range===20
+
+ i = 40;
+ i -= 10;
+ range(i); // $ range===30
+
+ i = j = 40;
+ range(i); // $ range===40
+
+ i = (j += 10);
+ range(i); // $ range===50
+
+ i = 20 + (j -= 10);
+ range(i); // $ range="==... += ...:... = ...+10" range===60
+}
+
+// Tests for unsigned multiplication.
+int test_unsigned_mult01(unsigned int a, unsigned b) {
+ int total = 0;
+
+ if (3 <= a && a <= 11 && 5 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=23 range=>=5
+ int r = a*b; // 15 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=>=1
+ }
+ if (3 <= a && a <= 11 && 0 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=23 range=>=0
+ int r = a*b; // 0 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=">=(unsigned int)...+0" range=>=0
+ }
+ if (3 <= a && a <= 11 && 13 <= b && b <= 23) {
+ range(a); // $ range=<=11 range=>=3
+ range(b); // $ range=<=23 range=>=13
+ int r = a*b; // 39 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=">=(unsigned int)...+1" range=>=1
+ }
+ range(total); // $ range=">=(unsigned int)...+0" range=>=0
+ return total;
+}
+
+int test_unsigned_mult02(unsigned b) {
+ int total = 0;
+
+ if (5 <= b && b <= 23) {
+ range(b); // $ range=<=23 range=>=5
+ int r = 11*b; // 55 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=>=1
+ }
+ if (0 <= b && b <= 23) {
+ range(b); // $ range=<=23 range=>=0
+ int r = 11*b; // 0 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=">=(unsigned int)...+0" range=>=0
+ }
+ if (13 <= b && b <= 23) {
+ range(b); // $ range=<=23 range=>=13
+ int r = 11*b; // 143 .. 253
+ range(r);
+ total += r;
+ range(total); // $ range=">=(unsigned int)...+1" range=>=1
+ }
+ range(total); // $ range=">=(unsigned int)...+0" range=>=0
+ return total;
+}
+
+unsigned long mult_rounding() {
+ unsigned long x, y, xy;
+ x = y = 1000000003UL; // 1e9 + 3
+ range(y); // $ range===1000000003
+ range(x); // $ range===1000000003
+ xy = x * y;
+ range(xy);
+ return xy; // BUG: upper bound should be >= 1000000006000000009UL
+}
+
+unsigned long mult_overflow() {
+ unsigned long x, y, xy;
+ x = 274177UL;
+ range(x); // $ range===274177
+ y = 67280421310721UL;
+ range(y);
+ xy = x * y;
+ range(xy);
+ return xy; // BUG: upper bound should be >= 18446744073709551617UL
+}
+
+unsigned long mult_lower_bound(unsigned int ui, unsigned long ul) {
+ if (ui >= 10) {
+ range(ui); // $ range=>=10
+ range((unsigned long)ui); // $ range=>=10
+ unsigned long result = (unsigned long)ui * ui;
+ range(result);
+ return result; // BUG: upper bound should be >= 18446744065119617025
+ }
+ if (ul >= 10) {
+ range(ul); // $ range=>=10
+ unsigned long result = ul * ul;
+ range(result);
+ return result; // BUG: lower bound should be 0 (overflow is possible)
+ }
+ return 0;
+}
+
+unsigned long mul_assign(unsigned int ui) {
+ if (ui <= 10 && ui >= 2) {
+ range(ui); // $ range=<=10 range=>=2
+ ui *= ui + 0;
+ range(ui);
+ return ui; // 4 .. 100
+ }
+
+ unsigned int uiconst = 10;
+ range(uiconst); // $ range===10
+ uiconst *= 4;
+ range(uiconst); // $ range===40
+
+ unsigned long ulconst = 10;
+ range(ulconst); // $ range===10
+ ulconst *= 4;
+ range(ulconst); // $ range===40
+ range(uiconst + ulconst); // $ range=">=... *= ...+1" range=>=41
+ return uiconst + ulconst; // 40 .. 40 for both
+}
+
+int mul_by_constant(int i, int j) {
+ if (i >= -1 && i <= 2) {
+ range(i); // $ range=<=2 range=>=-1
+ i = 5 * i;
+ range(i); // $ range=<=10 range=>=-5
+
+ i = i * -3;
+ range(i); // -30 .. 15
+
+ i *= 7;
+ range(i); // -210 .. 105
+
+ i *= -11;
+ range(i); // -1155 .. 2310
+ }
+ if (i == -1) {
+ range(i); // $ range===-1
+ range((int)0xffFFffFF); // $ range===-1
+ i = i * (int)0xffFFffFF; // fully converted literal is -1
+ range(i); // 1 .. 1
+ }
+ i = i * -1;
+ range( i); // -2^31 .. 2^31-1
+
+ signed char sc = 1;
+ range(sc); // $ range===1
+ i = (*&sc *= 2);
+ range(sc); // $ range===2
+ range(i); // $ range===2
+
+ return 0;
+}
+
+
+int notequal_type_endpoint(unsigned n) {
+ range(n); // 0 ..
+
+ if (n > 0) {
+ range(n); // $ range=>=1
+ }
+
+ if (n != 0) {
+ range(n); // 1 ..
+ } else {
+ range(n); // 0 .. 0
+ }
+
+ if (!n) {
+ range(n); // 0 .. 0
+ } else {
+ range(n); // 1 ..
+ }
+
+ while (n != 0) {
+ n--; // 1 ..
+ }
+
+ range(n); // $ range=<=n+0 // 0 .. 0
+}
+
+void notequal_refinement(short n) {
+ if (n < 0) {
+ range(n);
+ return;
+ }
+
+ if (n == 0) {
+ range(n); // 0 .. 0
+ } else {
+ range(n); // 1 ..
+ }
+
+ if (n) {
+ range(n); // 1 ..
+ } else {
+ range(n); // 0 .. 0
+ }
+
+ while (n != 0) {
+ range(n); // $ range=<=n+0
+ n--; // 1 ..
+ }
+
+ range(n); // $ range=<=n+0 // 0 .. 0
+}
+
+void notequal_variations(short n, float f) {
+ if (n != 0) {
+ if (n >= 0) {
+ range(n); // 1 .. [BUG: we can't handle `!=` coming first]
+ }
+ }
+
+ if (n >= 5) {
+ if (2 * n - 10 == 0) { // Same as `n == 10/2` (modulo overflow)
+ range(n);
+ return;
+ }
+ range(n); // 6 ..
+ }
+
+ if (n != -32768 && n != -32767) {
+ range(n); // -32766 ..
+ }
+
+ if (n >= 0) {
+ n ? (range(n), n) : (range(n), n); // ? 1.. : 0..0
+ !n ? (range(n), n) : (range(n), n); // ? 0..0 : 1..
+ }
+}
+
+void two_bounds_from_one_test(short ss, unsigned short us) {
+ // These tests demonstrate how the range analysis is often able to deduce
+ // both an upper bound and a lower bound even when there is only one
+ // inequality in the source. For example `signedInt < 4U` establishes that
+ // `signedInt >= 0` since if `signedInt` were negative then it would be
+ // greater than 4 in the unsigned comparison.
+
+ if (ss < sizeof(int)) { // Lower bound added in `linearBoundFromGuard`
+ range(ss); // 0 .. 3
+ }
+
+ if (ss < 0x8001) { // Lower bound removed in `getDefLowerBounds`
+ range(ss); // -32768 .. 32767
+ }
+
+ if ((short)us >= 0) {
+ range(us); // 0 .. 32767
+ }
+
+ if ((short)us >= -1) {
+ range(us); // 0 .. 65535
+ }
+
+ if (ss >= sizeof(int)) { // test is true for negative numbers
+ range(ss); // -32768 .. 32767
+ }
+
+ if (ss + 1 < sizeof(int)) {
+ range(ss); // -1 .. 2
+ }
+}
+
+void widen_recursive_expr() {
+ int s;
+ for (s = 0; s < 10; s++) {
+ range(s); // $ range=<=9 range=>=0
+ int result = s + s;
+ range(result); // 0 .. 18
+ }
+}
+
+void guard_bound_out_of_range(void) {
+ int i = 0;
+ if (i < 0) {
+ range(i); // unreachable [BUG: is -max .. +max]
+ }
+
+ unsigned int u = 0;
+ if (u < 0) {
+ range(u); // unreachable [BUG: is 0 .. +max]
+ }
+}
+
+void test_mod(int s) {
+ int s2 = s % 5;
+ range(s2); // $ range=<=4 // -4 .. 4
+}
+
+void exit(int);
+void guard_with_exit(int x, int y) {
+ if (x) {
+ if (y != 0) {
+ exit(0);
+ }
+ }
+ range(y); // ..
+
+ // This test ensures that we correctly identify
+ // that the upper bound for y is max_int when calling `range(y)`.
+}
+
+void test(int x) {
+ if (x >= 10) {
+ range(x); // $ range=>=10
+ return;
+ }
+ // The basic below has two predecessors.
+label:
+ range(x); // $ range=<=9
+ goto label;
+}
+
+void test_overflow() {
+ const int x = 2147483647; // 2^31-1
+ range(x);
+ const int y = 256;
+ range(y);
+ if ((x + y) <= 512) {
+ range(x);
+ range(y);
+ range(x + y); // $ range===-2147483393
+ }
+}
diff --git a/cpp/ql/test/library-tests/ir/range-analysis/test.cpp b/cpp/ql/test/library-tests/ir/range-analysis/test.cpp
index 2c819885b13..5290fffc8fd 100644
--- a/cpp/ql/test/library-tests/ir/range-analysis/test.cpp
+++ b/cpp/ql/test/library-tests/ir/range-analysis/test.cpp
@@ -1,4 +1,4 @@
-template void range(T value);
+#include "test_util.h"
int f1(int x, int y) {
if (x < 500) {
if (x > 400) {
diff --git a/cpp/ql/test/library-tests/ir/range-analysis/test_util.h b/cpp/ql/test/library-tests/ir/range-analysis/test_util.h
new file mode 100644
index 00000000000..3947dde3533
--- /dev/null
+++ b/cpp/ql/test/library-tests/ir/range-analysis/test_util.h
@@ -0,0 +1 @@
+template void range(T value);
\ No newline at end of file
diff --git a/cpp/ql/test/query-tests/Best Practices/Hiding/LocalVariableHidesGlobalVariable/LocalVariableHidesGlobalVariable.expected b/cpp/ql/test/query-tests/Best Practices/Hiding/LocalVariableHidesGlobalVariable/LocalVariableHidesGlobalVariable.expected
index 1ad05dacf8b..d79adba14e4 100644
--- a/cpp/ql/test/query-tests/Best Practices/Hiding/LocalVariableHidesGlobalVariable/LocalVariableHidesGlobalVariable.expected
+++ b/cpp/ql/test/query-tests/Best Practices/Hiding/LocalVariableHidesGlobalVariable/LocalVariableHidesGlobalVariable.expected
@@ -1,5 +1,5 @@
-| Hiding.c:22:25:22:26 | definition of gi | Local variable gi hides $@ with the same name. | Hiding.c:2:5:2:6 | gi | a global variable |
-| Hiding.c:23:25:23:26 | definition of gj | Local variable gj hides $@ with the same name. | Hiding.c:3:12:3:13 | gj | a global variable |
-| Hiding.c:24:25:24:26 | definition of gk | Local variable gk hides $@ with the same name. | Hiding.c:4:12:4:13 | gk | a global variable |
-| Hiding.c:37:20:37:21 | definition of g3 | Parameter g3 hides $@ with the same name. | Hiding.c:33:13:33:14 | g3 | a global variable |
-| Hiding.c:40:20:40:21 | definition of g5 | Parameter g5 hides $@ with the same name. | Hiding.c:33:21:33:22 | g5 | a global variable |
+| Hiding.c:22:25:22:26 | definition of gi | Local variable gi hides a $@ with the same name. | Hiding.c:2:5:2:6 | gi | global variable |
+| Hiding.c:23:25:23:26 | definition of gj | Local variable gj hides a $@ with the same name. | Hiding.c:3:12:3:13 | gj | global variable |
+| Hiding.c:24:25:24:26 | definition of gk | Local variable gk hides a $@ with the same name. | Hiding.c:4:12:4:13 | gk | global variable |
+| Hiding.c:37:20:37:21 | definition of g3 | Parameter g3 hides a $@ with the same name. | Hiding.c:33:13:33:14 | g3 | global variable |
+| Hiding.c:40:20:40:21 | definition of g5 | Parameter g5 hides a $@ with the same name. | Hiding.c:33:21:33:22 | g5 | global variable |
diff --git a/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/CommaBeforeMisleadingIndentation.expected b/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/CommaBeforeMisleadingIndentation.expected
new file mode 100644
index 00000000000..e993345aa39
--- /dev/null
+++ b/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/CommaBeforeMisleadingIndentation.expected
@@ -0,0 +1,5 @@
+| test.cpp:49:2:49:8 | (void)... | The indentation level may be misleading for some tab sizes. |
+| test.cpp:52:2:52:15 | (void)... | The indentation level may be misleading for some tab sizes. |
+| test.cpp:160:3:160:9 | (void)... | The indentation level may be misleading for some tab sizes. |
+| test.cpp:166:5:166:7 | ... ++ | The indentation level may be misleading for some tab sizes. |
+| test.cpp:176:6:178:6 | ... ? ... : ... | The indentation level may be misleading for some tab sizes. |
diff --git a/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/CommaBeforeMisleadingIndentation.qlref b/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/CommaBeforeMisleadingIndentation.qlref
new file mode 100644
index 00000000000..02b5f38e358
--- /dev/null
+++ b/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/CommaBeforeMisleadingIndentation.qlref
@@ -0,0 +1 @@
+Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql
diff --git a/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/test.cpp b/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/test.cpp
new file mode 100644
index 00000000000..dbf792db338
--- /dev/null
+++ b/cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/test.cpp
@@ -0,0 +1,208 @@
+// clang-format off
+
+typedef unsigned size_t;
+
+struct X {
+ int foo(int y) { return y; }
+} x;
+
+#define FOO(x) ( \
+ (x), \
+ (x) \
+)
+
+#define BAR(x, y) ((x), (y))
+
+#define BAZ //printf
+
+struct Foo {
+ int i, i_array[3];
+ int j;
+ virtual int foo(int) = 0;
+ virtual int bar(int, int) = 0;
+ int test(int (*baz)(int));
+
+ struct Tata {
+ struct Titi {
+ void tutu() {}
+ long toto() { return 42; }
+ } titi;
+
+ Titi *operator->() { return &titi; }
+ } *tata;
+};
+
+int Foo::test(int (*baz)(int))
+{
+ // Comma in simple if statement (prototypical example):
+
+ if (i)
+ (void)i, // GOOD
+ j++;
+
+ if (i)
+ this->foo(i), // GOOD
+ foo(i);
+
+ if (i)
+ (void)i, // BAD
+ (void)j;
+
+ if (1) FOO(i),
+ (void)x.foo(j); // BAD
+
+ // Parenthesized comma (borderline example):
+
+ foo(i++), j++; // GOOD
+ (foo(i++), j++); // GOOD
+ (foo(i++), // GOOD
+ j++);
+ (foo(i++),
+ foo(i++),
+ j++, // GOOD (?) -- Currently explicitly excluded
+ j++);
+
+ x.foo(i++), j++; // GOOD
+ (x.foo(i++), j++); // GOOD
+ (x.foo(i++), // GOOD
+ j++);
+ (x.foo(i++),
+ x.foo(i++),
+ j++, // GOOD (?) -- Currently explicitly excluded
+ j++);
+
+ FOO(i++), j++; // GOOD
+ (FOO(i++), j++); // GOOD
+ (FOO(i++), // GOOD
+ j++);
+ (FOO(i++),
+ FOO(i++),
+ j++, // GOOD (?) -- Currently explicitly excluded
+ j++);
+
+ (void)(i++), j++; // GOOD
+ ((void)(i++), j++); // GOOD
+ ((void)(i++), // GOOD
+ j++);
+ ((void)(i++),
+ (void)(i++),
+ j++, // GOOD (?) -- Currently explicitly excluded
+ j++);
+
+ // Comma in argument list doesn't count:
+
+ bar(i++, j++); // GOOD
+ bar(i++,
+ j++); // GOOD
+ bar(i++
+ , j++); // GOOD
+ bar(i++,
+ j++); // GOOD: common pattern and unlikely to be misread.
+
+ BAR(i++, j++); // GOOD
+ BAR(i++,
+ j++); // GOOD
+ BAR(i++
+ , j++); // GOOD
+ BAR(i++,
+ j++); // GOOD: common pattern and unlikely to be misread.
+
+ using T = decltype(x.foo(i++), // GOOD
+ j++);
+ (void)sizeof(x.foo(i++), // GOOD
+ j++);
+ using U = decltype(x.foo(i++), // GOOD? Unlikely to be misread
+ j++);
+ (void)sizeof(x.foo(i++), // GOOD? Unlikely to be misread
+ j++);
+
+ BAZ("%d %d\n", i,
+ j); // GOOD -- Currently explicitly excluded
+
+ // Comma in loops
+
+ while (i = foo(j++), // GOOD
+ i != j && i != 42 &&
+ !foo(j)) {
+ i = j = i + j;
+ }
+
+ while (i = foo(j++), // GOOD??? Currently ignoring loop heads
+ i != j && i != 42 && !foo(j)) {
+ i = j = i + j;
+ }
+
+ for (i = 0, // GOOD? Currently ignoring loop heads.
+ j = 1;
+ i + j < 10;
+ i++, j++);
+
+ for (i = 0,
+ j = 1; i < 10; i += 2, // GOOD? Currently ignoring loop heads.
+ j++) {}
+
+ // Comma in if-conditions:
+
+ if (i = foo(j++),
+ i == j) // GOOD(?) -- Currently ignoring if-conditions for the same reason as other parenthesized commas.
+ i = 0;
+
+ // Mixed tabs and spaces (ugly case):
+
+ for (i = 0, // GOOD if tab >= 4 spaces else BAD -- Currently ignoring loop heads.
+ j = 0;
+ i + j < 10;
+ i++, // GOOD if tab >= 4 spaces else BAD -- Currently ignoring loop heads.
+ j++);
+
+ if (i)
+ (void)i, // GOOD if tab >= 4 spaces else BAD -- can't exclude w/o source code text :/
+ (void)j;
+
+ // LHS ends on same line RHS begins on:
+
+ if (1) foo(
+ i++
+ ), j++; // GOOD? [FALSE POSITIVE]
+
+ if (1) baz(
+ i++
+ ), j++; // GOOD... when calling a function pointer..!?
+
+ // Weird cases:
+
+ if (foo(j))
+ return i++
+ , i++ // GOOD(?) [FALSE POSITIVE] -- can't exclude w/o source code text :/
+ ? 1
+ : 2;
+
+ int quux =
+ (tata->titi.tutu(),
+ foo(tata->titi.toto())); // GOOD
+
+ (*tata)->toto(), // GOOD
+ i_array[i] += (int)(*tata)->toto();
+
+ return quux;
+}
+
+// Comma in variadic template splice:
+
+namespace std {
+ template
+ struct index_sequence {};
+}
+
+template
+struct zip_index {};
+
+template
+int& at(zip_index) { throw 1; }
+
+template
+void for_each_input(Fn&& fn, std::index_sequence) {
+ (fn(zip_index{}, at(zip_index{})), ...); // GOOD
+}
+
+// clang-format on
diff --git a/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/extraction_error.c b/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/extraction_error.c
new file mode 100644
index 00000000000..66eedf743fb
--- /dev/null
+++ b/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/extraction_error.c
@@ -0,0 +1,15 @@
+// semmle-extractor-options: --expect_errors
+
+static void my_function1_called() {} // GOOD
+static void my_function2_called_after_error() {} // GOOD
+static void my_function3_not_called() {} // BAD [NOT DETECTED]
+
+int main(void) {
+ my_function1_called();
+
+--- compilation stops here because this line is not valid C code ---
+
+ my_function2_called_after_error();
+
+ return 0;
+}
diff --git a/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/unused_static_functions.cpp b/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/unused_static_functions.cpp
index 2984d8f0b1a..c0d83b52a57 100644
--- a/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/unused_static_functions.cpp
+++ b/cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticFunctions/unused_static_functions.cpp
@@ -33,3 +33,16 @@ static void f6(void);
static void f5(void) { f6(); }
static void f6(void) { f5(); }
+// f7 and f8 are reachable from `function_caller`
+static int f7() { return 1; } // GOOD
+static void f8() { } // GOOD
+
+void function_caller()
+{
+ auto my_lambda = []() {
+ return f7();
+ }();
+
+ f8();
+}
+
diff --git a/cpp/ql/test/query-tests/Likely Bugs/ShortLoopVarName/ShortLoopVarName.expected b/cpp/ql/test/query-tests/Likely Bugs/ShortLoopVarName/ShortLoopVarName.expected
index 16c5690bf75..22b1f8f4456 100644
--- a/cpp/ql/test/query-tests/Likely Bugs/ShortLoopVarName/ShortLoopVarName.expected
+++ b/cpp/ql/test/query-tests/Likely Bugs/ShortLoopVarName/ShortLoopVarName.expected
@@ -1,4 +1,4 @@
-| ShortLoopVarName.cpp:6:6:6:6 | i | Iteration variable i for $@ should have a descriptive name, since there is $@. | ShortLoopVarName.cpp:12:2:18:2 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:14:3:17:3 | for(...;...;...) ... | a nested loop |
-| ShortLoopVarName.cpp:30:13:30:13 | a | Iteration variable a for $@ should have a descriptive name, since there is $@. | ShortLoopVarName.cpp:30:2:38:2 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:34:3:37:3 | for(...;...;...) ... | a nested loop |
-| ShortLoopVarName.cpp:73:11:73:11 | y | Iteration variable y for $@ should have a descriptive name, since there is $@. | ShortLoopVarName.cpp:73:2:80:2 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:75:3:79:3 | for(...;...;...) ... | a nested loop |
-| ShortLoopVarName.cpp:96:12:96:12 | i | Iteration variable i for $@ should have a descriptive name, since there is $@. | ShortLoopVarName.cpp:96:3:102:3 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:98:4:101:4 | for(...;...;...) ... | a nested loop |
+| ShortLoopVarName.cpp:6:6:6:6 | i | Iteration variable i for $@ should have a descriptive name, since there is a $@. | ShortLoopVarName.cpp:12:2:18:2 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:14:3:17:3 | for(...;...;...) ... | nested loop |
+| ShortLoopVarName.cpp:30:13:30:13 | a | Iteration variable a for $@ should have a descriptive name, since there is a $@. | ShortLoopVarName.cpp:30:2:38:2 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:34:3:37:3 | for(...;...;...) ... | nested loop |
+| ShortLoopVarName.cpp:73:11:73:11 | y | Iteration variable y for $@ should have a descriptive name, since there is a $@. | ShortLoopVarName.cpp:73:2:80:2 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:75:3:79:3 | for(...;...;...) ... | nested loop |
+| ShortLoopVarName.cpp:96:12:96:12 | i | Iteration variable i for $@ should have a descriptive name, since there is a $@. | ShortLoopVarName.cpp:96:3:102:3 | for(...;...;...) ... | this loop | ShortLoopVarName.cpp:98:4:101:4 | for(...;...;...) ... | nested loop |
diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/UnterminatedVarargsCall.expected b/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/UnterminatedVarargsCall.expected
index e1b64faea28..2cf386e2f41 100644
--- a/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/UnterminatedVarargsCall.expected
+++ b/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/UnterminatedVarargsCall.expected
@@ -1,9 +1,9 @@
-| more_tests.cpp:23:2:23:12 | call to myFunction2 | Calls to $@ should use the value -1 as a terminator (4 calls do). | more_tests.cpp:5:6:5:16 | myFunction2 | myFunction2 |
-| more_tests.cpp:34:2:34:12 | call to myFunction4 | Calls to $@ should use the value 0 as a terminator (3 calls do). | more_tests.cpp:7:6:7:16 | myFunction4 | myFunction4 |
-| more_tests.cpp:44:2:44:12 | call to myFunction6 | Calls to $@ should use the value 0 as a terminator (3 calls do). | more_tests.cpp:9:6:9:16 | myFunction6 | myFunction6 |
-| more_tests.cpp:55:2:55:12 | call to myFunction7 | Calls to $@ should use the value 0 as a terminator (7 calls do). | more_tests.cpp:10:6:10:16 | myFunction7 | myFunction7 |
-| more_tests.cpp:56:2:56:12 | call to myFunction7 | Calls to $@ should use the value 0 as a terminator (7 calls do). | more_tests.cpp:10:6:10:16 | myFunction7 | myFunction7 |
-| tests.c:34:2:34:3 | call to f1 | Calls to $@ should use the value 0 as a terminator (4 calls do). | tests.c:4:6:4:7 | f1 | f1 |
-| tests.c:67:2:67:3 | call to f6 | Calls to $@ should use the value -1 as a terminator (3 calls do). | tests.c:24:6:24:7 | f6 | f6 |
-| tests.c:68:2:68:3 | call to f6 | Calls to $@ should use the value -1 as a terminator (3 calls do). | tests.c:24:6:24:7 | f6 | f6 |
-| tests.c:73:2:73:3 | call to f7 | Calls to $@ should use the value 0 as a terminator (3 calls do). | tests.c:28:6:28:7 | f7 | f7 |
+| more_tests.cpp:25:2:25:12 | call to myFunction2 | Calls to $@ should use the value -1 as a terminator (5 of 6 calls do). | more_tests.cpp:5:6:5:16 | myFunction2 | myFunction2 |
+| more_tests.cpp:39:2:39:12 | call to myFunction4 | Calls to $@ should use the value 0 as a terminator (5 of 6 calls do). | more_tests.cpp:7:6:7:16 | myFunction4 | myFunction4 |
+| more_tests.cpp:49:2:49:12 | call to myFunction6 | Calls to $@ should use the value 0 as a terminator (5 of 6 calls do). | more_tests.cpp:9:6:9:16 | myFunction6 | myFunction6 |
+| more_tests.cpp:64:2:64:12 | call to myFunction7 | Calls to $@ should use the value 0 as a terminator (9 of 11 calls do). | more_tests.cpp:10:6:10:16 | myFunction7 | myFunction7 |
+| more_tests.cpp:65:2:65:12 | call to myFunction7 | Calls to $@ should use the value 0 as a terminator (9 of 11 calls do). | more_tests.cpp:10:6:10:16 | myFunction7 | myFunction7 |
+| tests.c:34:2:34:3 | call to f1 | Calls to $@ should use the value 0 as a terminator (4 of 5 calls do). | tests.c:4:6:4:7 | f1 | f1 |
+| tests.c:78:2:78:3 | call to f6 | Calls to $@ should use the value -1 as a terminator (10 of 12 calls do). | tests.c:24:6:24:7 | f6 | f6 |
+| tests.c:79:2:79:3 | call to f6 | Calls to $@ should use the value -1 as a terminator (10 of 12 calls do). | tests.c:24:6:24:7 | f6 | f6 |
+| tests.c:84:2:84:3 | call to f7 | Calls to $@ should use the value 0 as a terminator (12 of 13 calls do). | tests.c:28:6:28:7 | f7 | f7 |
diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/more_tests.cpp b/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/more_tests.cpp
index a8c34fb490a..d6c9a3915e7 100644
--- a/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/more_tests.cpp
+++ b/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/more_tests.cpp
@@ -13,27 +13,32 @@ int main()
{
int x;
- myFunction1("%i", 0); // not common enough to be assumed a terminator
+ myFunction1("%i", 0); // GOOD: not common enough to be assumed a terminator
+ myFunction1("%i", 0);
myFunction1("%i", x);
myFunction2(-1);
myFunction2(0, -1);
myFunction2(0, 1, -1);
myFunction2(0, 1, 2, -1);
- myFunction2(0, 1, 2, 3); // missing terminator
+ myFunction2(0, 1, 2, 3, -1);
+ myFunction2(0, 1, 2, 3, 4); // BAD: missing terminator
myFunction3(-1);
myFunction3(0, -1);
- myFunction3(-1, 1, -1); // -1 isn't a terminator because it's used in a non-terminal position
+ myFunction3(-1, 1, -1); // GOOD: -1 isn't a terminator because it's used in a non-terminal position
myFunction3(0, 1, 2, -1);
- myFunction3(0, 1, 2, 3);
+ myFunction3(0, 1, 2, 3, -1);
+ myFunction3(0, 1, 2, 3, 4);
myFunction4(x, x, 0);
myFunction4(0, x, 1, 0);
myFunction4(0, 0, 1, 1, 0);
- myFunction4(x, 0, 1, 1, 1); // missing terminator
+ myFunction4(0, x, 1, 1, 1, 0);
+ myFunction4(0, 0, 1, 1, 1, 1, 0);
+ myFunction4(x, 0, 1, 1, 1, 1, 1); // BAD: missing terminator
- myFunction5('a', 'b', 'c', 0); // ambiguous terminator
+ myFunction5('a', 'b', 'c', 0); // GOOD: ambiguous terminator
myFunction5('a', 'b', 'c', 0);
myFunction5('a', 'b', 'c', 0);
myFunction5('a', 'b', 'c', -1);
@@ -41,19 +46,23 @@ int main()
myFunction5('a', 'b', 'c', -1);
myFunction6(0.0);
- myFunction6(1.0); // missing terminator
+ myFunction6(1.0); // BAD: missing terminator
myFunction6(1.0, 2.0, 0.0);
myFunction6(1.0, 2.0, 3.0, 0.0);
+ myFunction6(1.0, 2.0, 3.0, 4.0, 0.0);
+ myFunction6(1.0, 2.0, 3.0, 4.0, 5.0, 0.0);
myFunction7(NULL);
myFunction7("hello", "world", NULL);
myFunction7("apple", "banana", "pear", "mango", NULL);
myFunction7("dog", "cat", "elephant", "badger", "fish", NULL);
myFunction7("one", "two", "three", 0);
+ myFunction7("four", "five", "six", 0);
+ myFunction7("seven", "eight", "nine", 0);
myFunction7("alpha", "beta", "gamma", 0);
myFunction7("", 0);
- myFunction7("yes", "no"); // missing terminator
- myFunction7(); // missing terminator
+ myFunction7("yes", "no"); // BAD: missing terminator
+ myFunction7(); // BAD: missing terminator
return 0;
}
\ No newline at end of file
diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/tests.c b/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/tests.c
index a02a6e02b56..f89d19cf3c7 100644
--- a/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/tests.c
+++ b/cpp/ql/test/query-tests/Security/CWE/CWE-121/semmle/tests/tests.c
@@ -42,6 +42,7 @@ int main(int argc, char *argv[])
// GOOD: 0 is not common enough to be sure it's a terminator
f3("", 0);
+ f3("", 0);
f3("", 10);
// GOOD: -1 is not common enough to be sure it's a terminator
@@ -50,6 +51,9 @@ int main(int argc, char *argv[])
f4("", -1);
f4("", -1);
f4("", -1);
+ f4("", -1);
+ f4("", -1);
+ f4("", -1);
f4("", 1);
// GOOD: no obvious required terminator
@@ -61,16 +65,32 @@ int main(int argc, char *argv[])
f5("", 0);
f5("", 10);
- f6("fsdf", 3, 8, -1);
- f6("a", 7, 9, 10, -1);
- f6("a", 1, 22, 6, 17, 2, -1);
- f6("fgasfgas", 5, 6, argc); // BAD: not (necessarily) terminated with -1
- f6("sadfsaf"); // BAD: not terminated with -1
+ f6("a", 3, 8, -1);
+ f6("b", 7, 9, 10, -1);
+ f6("c", 1, 22, 6, 17, 2, -1);
+ f6("d", 1, -1);
+ f6("e", 1, 2, -1);
+ f6("f", 1, 2, 3, -1);
+ f6("g", 1, 2, 3, 4, -1);
+ f6("h", 5, -1);
+ f6("i", 5, 6, -1);
+ f6("j", 5, 6, 7, -1);
+ f6("k", 5, 6, argc); // BAD: not (necessarily) terminated with -1
+ f6("l"); // BAD: not terminated with -1
f7("", 0);
f7("", 0);
f7("", 0);
f7(""); // BAD: not terminated with 0
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
+ f7("", 0);
return 0;
}
\ No newline at end of file
diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-190/SAMATE/ArithmeticUncontrolled.expected b/cpp/ql/test/query-tests/Security/CWE/CWE-190/SAMATE/ArithmeticUncontrolled.expected
index b672d501c5e..3834d769463 100644
--- a/cpp/ql/test/query-tests/Security/CWE/CWE-190/SAMATE/ArithmeticUncontrolled.expected
+++ b/cpp/ql/test/query-tests/Security/CWE/CWE-190/SAMATE/ArithmeticUncontrolled.expected
@@ -52,27 +52,27 @@ nodes
| examples.cpp:38:9:38:12 | data | semmle.label | data |
subpaths
#select
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
-| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | Arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | (unsigned int)... | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:25:31:25:34 | data | examples.cpp:22:26:22:33 | call to rand | examples.cpp:25:31:25:34 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:22:26:22:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | (unsigned int)... | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
+| examples.cpp:38:9:38:12 | data | examples.cpp:35:26:35:33 | call to rand | examples.cpp:38:9:38:12 | data | This arithmetic expression depends on an $@, potentially causing an underflow. | examples.cpp:35:26:35:33 | call to rand | uncontrolled value |
diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/ArithmeticUncontrolled/ArithmeticUncontrolled.expected b/cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/ArithmeticUncontrolled/ArithmeticUncontrolled.expected
index efec436a131..011f8f73819 100644
--- a/cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/ArithmeticUncontrolled/ArithmeticUncontrolled.expected
+++ b/cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/ArithmeticUncontrolled/ArithmeticUncontrolled.expected
@@ -92,31 +92,31 @@ nodes
| test.cpp:219:8:219:8 | x | semmle.label | x |
subpaths
#select
-| test.c:21:17:21:17 | r | test.c:18:13:18:16 | call to rand | test.c:21:17:21:17 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:18:13:18:16 | call to rand | uncontrolled value |
-| test.c:35:5:35:5 | r | test.c:34:13:34:18 | call to rand | test.c:35:5:35:5 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:34:13:34:18 | call to rand | uncontrolled value |
-| test.c:45:5:45:5 | r | test.c:44:13:44:16 | call to rand | test.c:45:5:45:5 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:44:13:44:16 | call to rand | uncontrolled value |
-| test.c:77:9:77:9 | r | test.c:75:13:75:19 | call to rand | test.c:77:9:77:9 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:75:13:75:19 | call to rand | uncontrolled value |
-| test.c:77:9:77:9 | r | test.c:75:13:75:19 | call to rand | test.c:77:9:77:9 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:75:13:75:19 | call to rand | uncontrolled value |
-| test.c:83:9:83:9 | r | test.c:81:14:81:17 | call to rand | test.c:83:9:83:9 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:81:14:81:17 | call to rand | uncontrolled value |
-| test.c:83:9:83:9 | r | test.c:81:23:81:26 | call to rand | test.c:83:9:83:9 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:81:23:81:26 | call to rand | uncontrolled value |
-| test.c:127:9:127:9 | r | test.c:125:13:125:16 | call to rand | test.c:127:9:127:9 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:125:13:125:16 | call to rand | uncontrolled value |
-| test.c:133:5:133:5 | r | test.c:131:13:131:16 | call to rand | test.c:133:5:133:5 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:131:13:131:16 | call to rand | uncontrolled value |
-| test.c:139:10:139:10 | r | test.c:137:13:137:16 | call to rand | test.c:139:10:139:10 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.c:137:13:137:16 | call to rand | uncontrolled value |
-| test.c:157:9:157:9 | r | test.c:155:22:155:25 | call to rand | test.c:157:9:157:9 | r | Arithmetic expression depends on an $@, potentially causing an underflow. | test.c:155:22:155:25 | call to rand | uncontrolled value |
-| test.c:157:9:157:9 | r | test.c:155:22:155:27 | (unsigned int)... | test.c:157:9:157:9 | r | Arithmetic expression depends on an $@, potentially causing an underflow. | test.c:155:22:155:25 | call to rand | uncontrolled value |
-| test.cpp:25:7:25:7 | r | test.cpp:8:9:8:12 | call to rand | test.cpp:25:7:25:7 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:8:9:8:12 | call to rand | uncontrolled value |
-| test.cpp:31:7:31:7 | r | test.cpp:13:10:13:13 | call to rand | test.cpp:31:7:31:7 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:13:10:13:13 | call to rand | uncontrolled value |
-| test.cpp:37:7:37:7 | r | test.cpp:18:9:18:12 | call to rand | test.cpp:37:7:37:7 | r | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:18:9:18:12 | call to rand | uncontrolled value |
-| test.cpp:90:10:90:10 | x | test.cpp:86:10:86:13 | call to rand | test.cpp:90:10:90:10 | x | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:86:10:86:13 | call to rand | uncontrolled value |
-| test.cpp:102:10:102:10 | x | test.cpp:98:10:98:13 | call to rand | test.cpp:102:10:102:10 | x | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:98:10:98:13 | call to rand | uncontrolled value |
-| test.cpp:146:9:146:9 | y | test.cpp:137:10:137:13 | call to rand | test.cpp:146:9:146:9 | y | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:137:10:137:13 | call to rand | uncontrolled value |
-| test.cpp:154:10:154:10 | b | test.cpp:151:10:151:13 | call to rand | test.cpp:154:10:154:10 | b | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:151:10:151:13 | call to rand | uncontrolled value |
-| test.cpp:171:11:171:16 | (int)... | test.cpp:169:11:169:14 | call to rand | test.cpp:171:11:171:16 | (int)... | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:169:11:169:14 | call to rand | uncontrolled value |
-| test.cpp:171:16:171:16 | y | test.cpp:169:11:169:14 | call to rand | test.cpp:171:16:171:16 | y | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:169:11:169:14 | call to rand | uncontrolled value |
-| test.cpp:196:7:196:7 | x | test.cpp:189:10:189:13 | call to rand | test.cpp:196:7:196:7 | x | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:189:10:189:13 | call to rand | uncontrolled value |
-| test.cpp:198:7:198:7 | x | test.cpp:189:10:189:13 | call to rand | test.cpp:198:7:198:7 | x | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:189:10:189:13 | call to rand | uncontrolled value |
-| test.cpp:199:7:199:7 | x | test.cpp:189:10:189:13 | call to rand | test.cpp:199:7:199:7 | x | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:189:10:189:13 | call to rand | uncontrolled value |
-| test.cpp:204:7:204:7 | y | test.cpp:190:10:190:13 | call to rand | test.cpp:204:7:204:7 | y | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:190:10:190:13 | call to rand | uncontrolled value |
-| test.cpp:205:7:205:7 | y | test.cpp:190:10:190:13 | call to rand | test.cpp:205:7:205:7 | y | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:190:10:190:13 | call to rand | uncontrolled value |
-| test.cpp:208:7:208:7 | y | test.cpp:190:10:190:13 | call to rand | test.cpp:208:7:208:7 | y | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:190:10:190:13 | call to rand | uncontrolled value |
-| test.cpp:219:8:219:8 | x | test.cpp:215:11:215:14 | call to rand | test.cpp:219:8:219:8 | x | Arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:215:11:215:14 | call to rand | uncontrolled value |
+| test.c:21:17:21:17 | r | test.c:18:13:18:16 | call to rand | test.c:21:17:21:17 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:18:13:18:16 | call to rand | uncontrolled value |
+| test.c:35:5:35:5 | r | test.c:34:13:34:18 | call to rand | test.c:35:5:35:5 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:34:13:34:18 | call to rand | uncontrolled value |
+| test.c:45:5:45:5 | r | test.c:44:13:44:16 | call to rand | test.c:45:5:45:5 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:44:13:44:16 | call to rand | uncontrolled value |
+| test.c:77:9:77:9 | r | test.c:75:13:75:19 | call to rand | test.c:77:9:77:9 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:75:13:75:19 | call to rand | uncontrolled value |
+| test.c:77:9:77:9 | r | test.c:75:13:75:19 | call to rand | test.c:77:9:77:9 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:75:13:75:19 | call to rand | uncontrolled value |
+| test.c:83:9:83:9 | r | test.c:81:14:81:17 | call to rand | test.c:83:9:83:9 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:81:14:81:17 | call to rand | uncontrolled value |
+| test.c:83:9:83:9 | r | test.c:81:23:81:26 | call to rand | test.c:83:9:83:9 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:81:23:81:26 | call to rand | uncontrolled value |
+| test.c:127:9:127:9 | r | test.c:125:13:125:16 | call to rand | test.c:127:9:127:9 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:125:13:125:16 | call to rand | uncontrolled value |
+| test.c:133:5:133:5 | r | test.c:131:13:131:16 | call to rand | test.c:133:5:133:5 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:131:13:131:16 | call to rand | uncontrolled value |
+| test.c:139:10:139:10 | r | test.c:137:13:137:16 | call to rand | test.c:139:10:139:10 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.c:137:13:137:16 | call to rand | uncontrolled value |
+| test.c:157:9:157:9 | r | test.c:155:22:155:25 | call to rand | test.c:157:9:157:9 | r | This arithmetic expression depends on an $@, potentially causing an underflow. | test.c:155:22:155:25 | call to rand | uncontrolled value |
+| test.c:157:9:157:9 | r | test.c:155:22:155:27 | (unsigned int)... | test.c:157:9:157:9 | r | This arithmetic expression depends on an $@, potentially causing an underflow. | test.c:155:22:155:25 | call to rand | uncontrolled value |
+| test.cpp:25:7:25:7 | r | test.cpp:8:9:8:12 | call to rand | test.cpp:25:7:25:7 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:8:9:8:12 | call to rand | uncontrolled value |
+| test.cpp:31:7:31:7 | r | test.cpp:13:10:13:13 | call to rand | test.cpp:31:7:31:7 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:13:10:13:13 | call to rand | uncontrolled value |
+| test.cpp:37:7:37:7 | r | test.cpp:18:9:18:12 | call to rand | test.cpp:37:7:37:7 | r | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:18:9:18:12 | call to rand | uncontrolled value |
+| test.cpp:90:10:90:10 | x | test.cpp:86:10:86:13 | call to rand | test.cpp:90:10:90:10 | x | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:86:10:86:13 | call to rand | uncontrolled value |
+| test.cpp:102:10:102:10 | x | test.cpp:98:10:98:13 | call to rand | test.cpp:102:10:102:10 | x | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:98:10:98:13 | call to rand | uncontrolled value |
+| test.cpp:146:9:146:9 | y | test.cpp:137:10:137:13 | call to rand | test.cpp:146:9:146:9 | y | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:137:10:137:13 | call to rand | uncontrolled value |
+| test.cpp:154:10:154:10 | b | test.cpp:151:10:151:13 | call to rand | test.cpp:154:10:154:10 | b | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:151:10:151:13 | call to rand | uncontrolled value |
+| test.cpp:171:11:171:16 | (int)... | test.cpp:169:11:169:14 | call to rand | test.cpp:171:11:171:16 | (int)... | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:169:11:169:14 | call to rand | uncontrolled value |
+| test.cpp:171:16:171:16 | y | test.cpp:169:11:169:14 | call to rand | test.cpp:171:16:171:16 | y | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:169:11:169:14 | call to rand | uncontrolled value |
+| test.cpp:196:7:196:7 | x | test.cpp:189:10:189:13 | call to rand | test.cpp:196:7:196:7 | x | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:189:10:189:13 | call to rand | uncontrolled value |
+| test.cpp:198:7:198:7 | x | test.cpp:189:10:189:13 | call to rand | test.cpp:198:7:198:7 | x | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:189:10:189:13 | call to rand | uncontrolled value |
+| test.cpp:199:7:199:7 | x | test.cpp:189:10:189:13 | call to rand | test.cpp:199:7:199:7 | x | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:189:10:189:13 | call to rand | uncontrolled value |
+| test.cpp:204:7:204:7 | y | test.cpp:190:10:190:13 | call to rand | test.cpp:204:7:204:7 | y | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:190:10:190:13 | call to rand | uncontrolled value |
+| test.cpp:205:7:205:7 | y | test.cpp:190:10:190:13 | call to rand | test.cpp:205:7:205:7 | y | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:190:10:190:13 | call to rand | uncontrolled value |
+| test.cpp:208:7:208:7 | y | test.cpp:190:10:190:13 | call to rand | test.cpp:208:7:208:7 | y | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:190:10:190:13 | call to rand | uncontrolled value |
+| test.cpp:219:8:219:8 | x | test.cpp:215:11:215:14 | call to rand | test.cpp:219:8:219:8 | x | This arithmetic expression depends on an $@, potentially causing an overflow. | test.cpp:215:11:215:14 | call to rand | uncontrolled value |
diff --git a/csharp/extractor/Semmle.Extraction.CIL/Context.Factories.cs b/csharp/extractor/Semmle.Extraction.CIL/Context.Factories.cs
index 5ce1a58491f..a2fb43759df 100644
--- a/csharp/extractor/Semmle.Extraction.CIL/Context.Factories.cs
+++ b/csharp/extractor/Semmle.Extraction.CIL/Context.Factories.cs
@@ -218,7 +218,7 @@ namespace Semmle.Extraction.CIL
public PdbSourceFile CreateSourceFile(PDB.ISourceFile file) => sourceFiles[file];
///
- /// Creates a folder entitiy with the given path.
+ /// Creates a folder entity with the given path.
///
/// The path of the folder.
/// A folder entity.
diff --git a/csharp/extractor/Semmle.Extraction.CIL/Entities/Base/UnlabelledEntity.cs b/csharp/extractor/Semmle.Extraction.CIL/Entities/Base/UnlabelledEntity.cs
index 8f3d340d104..de563080d4b 100644
--- a/csharp/extractor/Semmle.Extraction.CIL/Entities/Base/UnlabelledEntity.cs
+++ b/csharp/extractor/Semmle.Extraction.CIL/Entities/Base/UnlabelledEntity.cs
@@ -5,7 +5,7 @@ namespace Semmle.Extraction.CIL
{
///
/// An entity that has contents to extract. There is no need to populate
- /// a key as it's done in the contructor.
+ /// a key as it's done in the constructor.
///
internal abstract class UnlabelledEntity : Extraction.UnlabelledEntity, IExtractedEntity
{
diff --git a/csharp/extractor/Semmle.Extraction.CIL/Entities/IMember.cs b/csharp/extractor/Semmle.Extraction.CIL/Entities/IMember.cs
index 1e2cc7aacac..37c0af7702b 100644
--- a/csharp/extractor/Semmle.Extraction.CIL/Entities/IMember.cs
+++ b/csharp/extractor/Semmle.Extraction.CIL/Entities/IMember.cs
@@ -1,7 +1,7 @@
namespace Semmle.Extraction.CIL.Entities
{
///
- /// An entity represting a member.
+ /// An entity representing a member.
/// Used to type tuples correctly.
///
internal interface IMember : IExtractedEntity
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/CachedSymbol.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/CachedSymbol.cs
index e03f945175b..bf7c2ca42b1 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/CachedSymbol.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/CachedSymbol.cs
@@ -66,7 +66,7 @@ namespace Semmle.Extraction.CSharp.Entities
}
///
- /// The location which is stored in the database and is used when highlighing source code.
+ /// The location which is stored in the database and is used when highlighting source code.
/// It's generally short, e.g. a method name.
///
public override Microsoft.CodeAnalysis.Location? ReportingLocation => Symbol.Locations.FirstOrDefault();
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/EventAccessor.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/EventAccessor.cs
index b578f51e0e0..e18d72350d8 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/EventAccessor.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/EventAccessor.cs
@@ -42,7 +42,7 @@ namespace Semmle.Extraction.CSharp.Entities
}
else
{
- Context.ModelError(Symbol, $"Undhandled event accessor kind {Symbol.ToDisplayString()}");
+ Context.ModelError(Symbol, $"Unhandled event accessor kind {Symbol.ToDisplayString()}");
return;
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs
index 5c3a48c05ae..6e0380da693 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs
@@ -74,7 +74,7 @@ namespace Semmle.Extraction.CSharp.Entities
bool IExpressionParentEntity.IsTopLevelParent => false;
///
- /// Gets a string represention of a constant value.
+ /// Gets a string representation of a constant value.
///
/// The value.
/// The string representation.
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs
index a94f0b54747..4ed4f2b6fb2 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs
@@ -23,7 +23,7 @@ namespace Semmle.Extraction.CSharp.Entities
trapFile.modifiers(Label, Symbol);
}
- public static string AccessbilityModifier(Accessibility access)
+ public static string AccessibilityModifier(Accessibility access)
{
switch (access)
{
@@ -48,7 +48,7 @@ namespace Semmle.Extraction.CSharp.Entities
case Accessibility.Public:
case Accessibility.Protected:
case Accessibility.Internal:
- HasModifier(cx, trapFile, type, Modifier.AccessbilityModifier(access));
+ HasModifier(cx, trapFile, type, Modifier.AccessibilityModifier(access));
break;
case Accessibility.NotApplicable:
break;
@@ -131,7 +131,7 @@ namespace Semmle.Extraction.CSharp.Entities
public static Modifier Create(Context cx, Accessibility access)
{
- var modifier = AccessbilityModifier(access);
+ var modifier = AccessibilityModifier(access);
return ModifierFactory.Instance.CreateEntity(cx, (typeof(Modifier), modifier), modifier);
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs b/csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs
index 26a104286a8..6018b9903c1 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs
@@ -10,7 +10,7 @@ namespace Semmle.Extraction.CSharp
{
///
/// An ITypeSymbol with nullability annotations.
- /// Although a similar class has been implemented in Rolsyn,
+ /// Although a similar class has been implemented in Roslyn,
/// https://github.com/dotnet/roslyn/blob/090e52e27c38ad8f1ea4d033114c2a107604ddaa/src/Compilers/CSharp/Portable/Symbols/TypeWithAnnotations.cs
/// it is an internal struct that has not yet been exposed on the public interface.
///
@@ -80,8 +80,8 @@ namespace Semmle.Extraction.CSharp
public static IEnumerable GetSourceLevelModifiers(this ISymbol symbol)
{
var methodModifiers = symbol.GetModifiers(md => md.Modifiers);
- var typeModifers = symbol.GetModifiers(cd => cd.Modifiers);
- return methodModifiers.Concat(typeModifers).Select(m => m.Text);
+ var typeModifiers = symbol.GetModifiers(cd => cd.Modifiers);
+ return methodModifiers.Concat(typeModifiers).Select(m => m.Text);
}
///
diff --git a/csharp/extractor/Semmle.Extraction/Entities/Base/IEntity.cs b/csharp/extractor/Semmle.Extraction/Entities/Base/IEntity.cs
index dcf8dcbc373..f103296107d 100644
--- a/csharp/extractor/Semmle.Extraction/Entities/Base/IEntity.cs
+++ b/csharp/extractor/Semmle.Extraction/Entities/Base/IEntity.cs
@@ -26,7 +26,7 @@ namespace Semmle.Extraction
Label Label { get; set; }
///
- /// Writes the unique identifier of this entitiy to a trap file.
+ /// Writes the unique identifier of this entity to a trap file.
///
/// The trapfile to write to.
void WriteId(EscapingTextWriter trapFile);
diff --git a/csharp/extractor/Semmle.Util/Enumerators.cs b/csharp/extractor/Semmle.Util/Enumerators.cs
index 3d77e2522b6..16fad6cfa54 100644
--- a/csharp/extractor/Semmle.Util/Enumerators.cs
+++ b/csharp/extractor/Semmle.Util/Enumerators.cs
@@ -8,7 +8,7 @@ namespace Semmle.Util
/// Create an enumerable with a single element.
///
///
- /// The type of the enumerble/element.
+ /// The type of the enumerable/element.
/// The element.
/// An enumerable containing a single element.
public static IEnumerable Singleton(T t)
diff --git a/csharp/extractor/Semmle.Util/FuzzyDictionary.cs b/csharp/extractor/Semmle.Util/FuzzyDictionary.cs
index 9f61fa1ffa9..53a84d98a08 100644
--- a/csharp/extractor/Semmle.Util/FuzzyDictionary.cs
+++ b/csharp/extractor/Semmle.Util/FuzzyDictionary.cs
@@ -17,7 +17,7 @@ namespace Semmle.Util
/// The algorithm locates the closest match to a string based on a "distance function".
///
/// Whilst many distance functions are possible, a bespoke algorithm is used here,
- /// for efficiency and suitablility for the domain.
+ /// for efficiency and suitability for the domain.
///
/// The distance is defined as the Hamming Distance of the numbers in the string.
/// Each string is split into the base "form" (stripped of numbers) and a vector of
diff --git a/csharp/old-change-notes/2020-08-26-implicit-array-lengths.md b/csharp/old-change-notes/2020-08-26-implicit-array-lengths.md
index 7152975b292..e13a60e0f61 100644
--- a/csharp/old-change-notes/2020-08-26-implicit-array-lengths.md
+++ b/csharp/old-change-notes/2020-08-26-implicit-array-lengths.md
@@ -1,5 +1,5 @@
lgtm,codescanning
-* Inferring the lengths of implicitely sized arrays is fixed. Previously, multi
+* Inferring the lengths of implicitly sized arrays is fixed. Previously, multi
dimensional arrays were always extracted with the same length for each dimension.
With the fix, the array sizes `2` and `1` are extracted for `new int[,]{{1},{2}}`.
Previously `2` and `2` were extracted.
diff --git a/csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md b/csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md
index 49d355ec453..afbbf19794a 100644
--- a/csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md
+++ b/csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.1
+
+No user-facing changes.
+
## 1.3.0
No user-facing changes.
diff --git a/csharp/ql/campaigns/Solorigate/lib/Solorigate.qll b/csharp/ql/campaigns/Solorigate/lib/Solorigate.qll
index 6947fc05bb1..51559093b07 100644
--- a/csharp/ql/campaigns/Solorigate/lib/Solorigate.qll
+++ b/csharp/ql/campaigns/Solorigate/lib/Solorigate.qll
@@ -124,7 +124,7 @@ string solorigateSuspiciousLiterals() {
"fc00::", "fe00::", "fec0::", "ffc0::", "ff00::", "HKCC", "HKCR", "HKCU", "HKDD",
"HKEY_CLASSES_ROOT", "HKEY_CURRENT_CONFIG", "HKEY_CURRENT_USER", "HKEY_DYN_DATA",
"HKEY_LOCAL_MACHINE", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography",
- "HKEY_PERFOMANCE_DATA", "HKEY_USERS", "HKLM", "HKPD", "HKU", "If-None-Match",
+ "HKEY_PERFORMANCE_DATA", "HKEY_USERS", "HKLM", "HKPD", "HKU", "If-None-Match",
"Microsoft-CryptoAPI/", "Nodes", "Volumes", "Interfaces", "Components", "opensans",
"Organization", "OSArchitecture", "ParentProcessID", "PathName", "ReportWatcherPostpone",
"ReportWatcherRetry", "S-1-5-", "SeRestorePrivilege", "SeShutdownPrivilege",
diff --git a/csharp/ql/campaigns/Solorigate/lib/change-notes/released/1.3.1.md b/csharp/ql/campaigns/Solorigate/lib/change-notes/released/1.3.1.md
new file mode 100644
index 00000000000..8dd9964197c
--- /dev/null
+++ b/csharp/ql/campaigns/Solorigate/lib/change-notes/released/1.3.1.md
@@ -0,0 +1,3 @@
+## 1.3.1
+
+No user-facing changes.
diff --git a/csharp/ql/campaigns/Solorigate/lib/codeql-pack.release.yml b/csharp/ql/campaigns/Solorigate/lib/codeql-pack.release.yml
index ec16350ed6f..e71b6d081f1 100644
--- a/csharp/ql/campaigns/Solorigate/lib/codeql-pack.release.yml
+++ b/csharp/ql/campaigns/Solorigate/lib/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 1.3.0
+lastReleaseVersion: 1.3.1
diff --git a/csharp/ql/campaigns/Solorigate/lib/qlpack.yml b/csharp/ql/campaigns/Solorigate/lib/qlpack.yml
index 648df77d7ff..96ed3493829 100644
--- a/csharp/ql/campaigns/Solorigate/lib/qlpack.yml
+++ b/csharp/ql/campaigns/Solorigate/lib/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-all
-version: 1.3.1-dev
+version: 1.3.2-dev
groups:
- csharp
- solorigate
diff --git a/csharp/ql/campaigns/Solorigate/src/CHANGELOG.md b/csharp/ql/campaigns/Solorigate/src/CHANGELOG.md
index 49d355ec453..afbbf19794a 100644
--- a/csharp/ql/campaigns/Solorigate/src/CHANGELOG.md
+++ b/csharp/ql/campaigns/Solorigate/src/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.1
+
+No user-facing changes.
+
## 1.3.0
No user-facing changes.
diff --git a/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql b/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql
index 5e4a47f7ec0..e09d00807e6 100644
--- a/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql
+++ b/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql
@@ -27,6 +27,5 @@ where
xor2.getAnOperand() = v.getAnAccess()
)
)
-select l,
- "The variable $@ seems to be used as part of a FNV-like hash calculation, that is modified by an additional $@ expression using literal $@.",
- v, v.toString(), additional_xor, "xor", l, l.toString()
+select l, "This literal is used in an $@ after an FNV-like hash calculation with variable $@.",
+ additional_xor, "additional xor", v, v.toString()
diff --git a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownCommandsAboveThreshold.ql b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownCommandsAboveThreshold.ql
index 42fb738f157..cdb8670186c 100644
--- a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownCommandsAboveThreshold.ql
+++ b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownCommandsAboveThreshold.ql
@@ -34,5 +34,5 @@ where
total = countSolorigateCommandInEnum(e) and
total > 10
select e,
- "The enum $@ may be related to Solorigate. It matches " + total +
- " of the values used for commands in the enum.", e, e.getName()
+ "This enum may be related to Solorigate. It matches " + total +
+ " of the values used for commands in the enum."
diff --git a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownHashesAboveThreshold.ql b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownHashesAboveThreshold.ql
index 541f3205c01..5aeb3b8ccc9 100644
--- a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownHashesAboveThreshold.ql
+++ b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownHashesAboveThreshold.ql
@@ -29,5 +29,5 @@ where
isSolorigateHash(l) and
total > threshold
select l,
- "The Hash literal $@ may be related to the Solorigate campaign. Total count = " + total +
- " is above the threshold " + threshold + ".", l, l.getValue()
+ "This Hash literal may be related to the Solorigate campaign. Total count = " + total +
+ " is above the threshold " + threshold + "."
diff --git a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownLiteralsAboveThreshold.ql b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownLiteralsAboveThreshold.ql
index a18f0c40916..bae2faa7674 100644
--- a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownLiteralsAboveThreshold.ql
+++ b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownLiteralsAboveThreshold.ql
@@ -29,5 +29,5 @@ where
isSolorigateLiteral(l) and
total > threshold
select l,
- "The literal $@ may be related to the Solorigate campaign. Total count = " + total +
- " is above the threshold " + threshold + ".", l, l.getValue()
+ "This literal may be related to the Solorigate campaign. Total count = " + total +
+ " is above the threshold " + threshold + "."
diff --git a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownMethodNamesAboveThreshold.ql b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownMethodNamesAboveThreshold.ql
index 430329c3a10..6e3834a46c7 100644
--- a/csharp/ql/campaigns/Solorigate/src/NumberOfKnownMethodNamesAboveThreshold.ql
+++ b/csharp/ql/campaigns/Solorigate/src/NumberOfKnownMethodNamesAboveThreshold.ql
@@ -28,5 +28,5 @@ where
isSolorigateSuspiciousMethodName(m) and
total > threshold
select m,
- "The method $@ may be related to Solorigate. Total count = " + total + " is above the threshold " +
- threshold + ".", m, m.getName()
+ "This method may be related to Solorigate. Total count = " + total + " is above the threshold " +
+ threshold + "."
diff --git a/csharp/ql/campaigns/Solorigate/src/change-notes/released/1.3.1.md b/csharp/ql/campaigns/Solorigate/src/change-notes/released/1.3.1.md
new file mode 100644
index 00000000000..8dd9964197c
--- /dev/null
+++ b/csharp/ql/campaigns/Solorigate/src/change-notes/released/1.3.1.md
@@ -0,0 +1,3 @@
+## 1.3.1
+
+No user-facing changes.
diff --git a/csharp/ql/campaigns/Solorigate/src/codeql-pack.release.yml b/csharp/ql/campaigns/Solorigate/src/codeql-pack.release.yml
index ec16350ed6f..e71b6d081f1 100644
--- a/csharp/ql/campaigns/Solorigate/src/codeql-pack.release.yml
+++ b/csharp/ql/campaigns/Solorigate/src/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 1.3.0
+lastReleaseVersion: 1.3.1
diff --git a/csharp/ql/campaigns/Solorigate/src/qlpack.yml b/csharp/ql/campaigns/Solorigate/src/qlpack.yml
index 940cdf055f8..888b9099b3d 100644
--- a/csharp/ql/campaigns/Solorigate/src/qlpack.yml
+++ b/csharp/ql/campaigns/Solorigate/src/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-queries
-version: 1.3.1-dev
+version: 1.3.2-dev
groups:
- csharp
- solorigate
diff --git a/csharp/ql/campaigns/Solorigate/test/Solorigate/ModifiedFnvFunctionDetection.expected b/csharp/ql/campaigns/Solorigate/test/Solorigate/ModifiedFnvFunctionDetection.expected
index a82479c30bd..53407ecb208 100644
--- a/csharp/ql/campaigns/Solorigate/test/Solorigate/ModifiedFnvFunctionDetection.expected
+++ b/csharp/ql/campaigns/Solorigate/test/Solorigate/ModifiedFnvFunctionDetection.expected
@@ -1 +1 @@
-| test.cs:39:16:39:36 | 6605813339339102567 | The variable $@ seems to be used as part of a FNV-like hash calculation, that is modified by an additional $@ expression using literal $@. | test.cs:25:9:25:11 | num | num | test.cs:39:10:39:36 | ... ^ ... | xor | test.cs:39:16:39:36 | 6605813339339102567 | 6605813339339102567 |
+| test.cs:39:16:39:36 | 6605813339339102567 | This literal is used in an $@ after a FNV-like hash calculation with variable $@. | test.cs:39:10:39:36 | ... ^ ... | additional xor | test.cs:25:9:25:11 | num | num |
diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_run/test.py b/csharp/ql/integration-tests/all-platforms/dotnet_run/test.py
index b4e8d27fcbd..be1b516ce5a 100644
--- a/csharp/ql/integration-tests/all-platforms/dotnet_run/test.py
+++ b/csharp/ql/integration-tests/all-platforms/dotnet_run/test.py
@@ -41,3 +41,7 @@ check_build_out("hello, world", s)
# to `dotnet run -p:UseSharedCompilation=true -p:UseSharedCompilation=false -- hello world`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test6-db', 'dotnet run -p:UseSharedCompilation=true -- hello world'], "test7-db")
check_build_out("hello, world", s)
+
+# option passed into `dotnet run`
+s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test7-db', 'dotnet build', 'dotnet run --no-build hello world'], "test8-db")
+check_build_out("hello, world", s)
diff --git a/csharp/ql/lib/CHANGELOG.md b/csharp/ql/lib/CHANGELOG.md
index 83b9e7b837c..c303fa86a4a 100644
--- a/csharp/ql/lib/CHANGELOG.md
+++ b/csharp/ql/lib/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 0.4.1
+
+### Minor Analysis Improvements
+
+* `DateTime` expressions are now considered simple type sanitizers. This affects a wide range of security queries.
+* ASP.NET Core controller definition has been made more precise. The amount of introduced taint sources or eliminated false positives should be low though, since the most common pattern is to derive all user defined ASP.NET Core controllers from the standard Controller class, which is not affected.
+
## 0.4.0
### Deprecated APIs
diff --git a/csharp/ql/lib/change-notes/2022-09-23-simpletypesanitizer.md b/csharp/ql/lib/change-notes/2022-09-23-simpletypesanitizer.md
deleted file mode 100644
index a4d7e4cde7a..00000000000
--- a/csharp/ql/lib/change-notes/2022-09-23-simpletypesanitizer.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-category: minorAnalysis
----
-* `DateTime` expressions are now considered simple type sanitizers. This affects a wide range of security queries.
\ No newline at end of file
diff --git a/csharp/ql/lib/change-notes/2022-08-24-aps-net-core-controllers.md b/csharp/ql/lib/change-notes/released/0.4.1.md
similarity index 65%
rename from csharp/ql/lib/change-notes/2022-08-24-aps-net-core-controllers.md
rename to csharp/ql/lib/change-notes/released/0.4.1.md
index b3b5006bc57..f3bdef7797c 100644
--- a/csharp/ql/lib/change-notes/2022-08-24-aps-net-core-controllers.md
+++ b/csharp/ql/lib/change-notes/released/0.4.1.md
@@ -1,4 +1,6 @@
----
-category: minorAnalysis
----
+## 0.4.1
+
+### Minor Analysis Improvements
+
+* `DateTime` expressions are now considered simple type sanitizers. This affects a wide range of security queries.
* ASP.NET Core controller definition has been made more precise. The amount of introduced taint sources or eliminated false positives should be low though, since the most common pattern is to derive all user defined ASP.NET Core controllers from the standard Controller class, which is not affected.
diff --git a/csharp/ql/lib/codeql-pack.release.yml b/csharp/ql/lib/codeql-pack.release.yml
index 458bfbeccff..89fa3a87180 100644
--- a/csharp/ql/lib/codeql-pack.release.yml
+++ b/csharp/ql/lib/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 0.4.0
+lastReleaseVersion: 0.4.1
diff --git a/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll b/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll
index 28de629816d..b7371fafb3e 100644
--- a/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll
+++ b/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll
@@ -10,7 +10,9 @@ import csharp
private import DataFlow
private import semmle.code.csharp.dataflow.TaintTracking2
-predicate maybeANonCryptogrphicHash(Callable callable, Variable v, Expr xor, Expr mul, LoopStmt loop) {
+predicate maybeANonCryptographicHash(
+ Callable callable, Variable v, Expr xor, Expr mul, LoopStmt loop
+) {
callable = loop.getEnclosingCallable() and
(
maybeUsedInFnvFunction(v, xor, mul, loop) or
@@ -75,7 +77,7 @@ private predicate maybeUsedInElfHashFunction(Variable v, Operation xor, Operatio
*/
predicate isCallableAPotentialNonCryptographicHashFunction(Callable callable, Parameter param) {
exists(Variable v, Expr op1, Expr op2, LoopStmt loop |
- maybeANonCryptogrphicHash(callable, v, op1, op2, loop) and
+ maybeANonCryptographicHash(callable, v, op1, op2, loop) and
callable.getAParameter() = param and
exists(ParameterNode p, ExprNode n |
p.getParameter() = param and
diff --git a/csharp/ql/lib/qlpack.yml b/csharp/ql/lib/qlpack.yml
index 270ae8a65aa..8b00f8845c2 100644
--- a/csharp/ql/lib/qlpack.yml
+++ b/csharp/ql/lib/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/csharp-all
-version: 0.4.1-dev
+version: 0.4.2-dev
groups: csharp
dbscheme: semmlecode.csharp.dbscheme
extractor: csharp
diff --git a/csharp/ql/lib/semmle/code/cil/DataFlow.qll b/csharp/ql/lib/semmle/code/cil/DataFlow.qll
index 55f8eb89432..9057cccf49b 100644
--- a/csharp/ql/lib/semmle/code/cil/DataFlow.qll
+++ b/csharp/ql/lib/semmle/code/cil/DataFlow.qll
@@ -20,16 +20,18 @@ class DataFlowNode extends @cil_dataflow_node {
* Holds if this node flows to `sink` in one step.
* `tt` is the tainting that occurs during this step.
*/
- predicate getALocalFlowSucc(DataFlowNode sink, TaintType tt) {
+ deprecated predicate getALocalFlowSucc(DataFlowNode sink, TaintType tt) {
localExactStep(this, sink) and tt = TExactValue()
or
localTaintStep(this, sink) and tt = TTaintedValue()
}
- private predicate flowsToStep(DataFlowNode sink) { this.getALocalFlowSucc(sink, TExactValue()) }
+ deprecated private predicate flowsToStep(DataFlowNode sink) {
+ this.getALocalFlowSucc(sink, TExactValue())
+ }
/** Holds if this node flows to `sink` in zero or more steps. */
- predicate flowsTo(DataFlowNode sink) { this.flowsToStep*(sink) }
+ deprecated predicate flowsTo(DataFlowNode sink) { this.flowsToStep*(sink) }
/** Gets the method that contains this dataflow node. */
Method getMethod() { none() }
@@ -38,12 +40,12 @@ class DataFlowNode extends @cil_dataflow_node {
Location getLocation() { none() }
}
-private newtype TTaintType =
+deprecated private newtype TTaintType =
TExactValue() or
TTaintedValue()
/** Describes how data is tainted. */
-class TaintType extends TTaintType {
+deprecated class TaintType extends TTaintType {
string toString() {
this = TExactValue() and result = "exact"
or
@@ -52,12 +54,12 @@ class TaintType extends TTaintType {
}
/** A taint type where the data is untainted. */
-class Untainted extends TaintType, TExactValue { }
+deprecated class Untainted extends TaintType, TExactValue { }
/** A taint type where the data is tainted. */
-class Tainted extends TaintType, TTaintedValue { }
+deprecated class Tainted extends TaintType, TTaintedValue { }
-private predicate localFlowPhiInput(DataFlowNode input, Ssa::PhiNode phi) {
+deprecated private predicate localFlowPhiInput(DataFlowNode input, Ssa::PhiNode phi) {
exists(Ssa::Definition def, BasicBlock bb, int i | phi.hasLastInputRef(def, bb, i) |
def.definesAt(_, bb, i) and
input = def.getVariableUpdate().getSource()
@@ -76,7 +78,7 @@ private predicate localFlowPhiInput(DataFlowNode input, Ssa::PhiNode phi) {
)
}
-private predicate localExactStep(DataFlowNode src, DataFlowNode sink) {
+deprecated private predicate localExactStep(DataFlowNode src, DataFlowNode sink) {
src = sink.(Opcodes::Dup).getAnOperand()
or
exists(Ssa::Definition def, VariableUpdate vu |
@@ -103,7 +105,7 @@ private predicate localExactStep(DataFlowNode src, DataFlowNode sink) {
src = sink.(ConditionalBranch).getAnOperand()
}
-private predicate localTaintStep(DataFlowNode src, DataFlowNode sink) {
+deprecated private predicate localTaintStep(DataFlowNode src, DataFlowNode sink) {
src = sink.(BinaryArithmeticExpr).getAnOperand() or
src = sink.(Opcodes::Neg).getOperand() or
src = sink.(UnaryBitwiseOperation).getOperand()
diff --git a/csharp/ql/lib/semmle/code/cil/Method.qll b/csharp/ql/lib/semmle/code/cil/Method.qll
index f4f65bbaca1..da1c46b5dfd 100644
--- a/csharp/ql/lib/semmle/code/cil/Method.qll
+++ b/csharp/ql/lib/semmle/code/cil/Method.qll
@@ -270,7 +270,7 @@ class Setter extends Accessor {
*/
class TrivialSetter extends Method {
TrivialSetter() {
- exists(MethodImplementation impl | impl = this.getImplementation() |
+ exists(MethodImplementation impl | impl = this.getAnImplementation() |
impl.getInstruction(0) instanceof ThisAccess and
impl.getInstruction(1).(ParameterReadAccess).getTarget().getIndex() = 1 and
impl.getInstruction(2) instanceof FieldWriteAccess
diff --git a/csharp/ql/lib/semmle/code/cil/Ssa.qll b/csharp/ql/lib/semmle/code/cil/Ssa.qll
index 50338d3284d..ec419c1773a 100644
--- a/csharp/ql/lib/semmle/code/cil/Ssa.qll
+++ b/csharp/ql/lib/semmle/code/cil/Ssa.qll
@@ -24,10 +24,10 @@ module Ssa {
}
/** Gets a first read of this SSA definition. */
- final ReadAccess getAFirstRead() { result = SsaImpl::getAFirstRead(this) }
+ deprecated final ReadAccess getAFirstRead() { result = SsaImpl::getAFirstRead(this) }
/** Holds if `first` and `second` are adjacent reads of this SSA definition. */
- final predicate hasAdjacentReads(ReadAccess first, ReadAccess second) {
+ deprecated final predicate hasAdjacentReads(ReadAccess first, ReadAccess second) {
SsaImpl::hasAdjacentReads(this, first, second)
}
@@ -58,8 +58,9 @@ module Ssa {
* index `i` in basic block `bb` can reach this phi node without going through
* other references.
*/
- final predicate hasLastInputRef(Definition def, BasicBlock bb, int i) {
- SsaImpl::hasLastInputRef(this, def, bb, i)
+ deprecated final predicate hasLastInputRef(Definition def, BasicBlock bb, int i) {
+ SsaImpl::lastRefRedef(def, bb, i, this) and
+ def = SsaImpl::getAPhiInput(this)
}
}
}
diff --git a/csharp/ql/lib/semmle/code/cil/Stubs.qll b/csharp/ql/lib/semmle/code/cil/Stubs.qll
index 692b7750f1f..afe95d3ae77 100644
--- a/csharp/ql/lib/semmle/code/cil/Stubs.qll
+++ b/csharp/ql/lib/semmle/code/cil/Stubs.qll
@@ -29,14 +29,17 @@ private module Cached {
cached
predicate bestImplementation(MethodImplementation mi) {
- not assemblyIsStubImpl(mi.getLocation()) and
- not exists(MethodImplementation better | mi.getMethod() = better.getMethod() |
- mi.getNumberOfInstructions() < better.getNumberOfInstructions()
- or
- mi.getNumberOfInstructions() = better.getNumberOfInstructions() and
- mi.getLocation().getFile().toString() > better.getLocation().getFile().toString()
- ) and
- exists(mi.getAnInstruction())
+ exists(Assembly asm |
+ asm = mi.getLocation() and
+ (assemblyIsStubImpl(asm) implies asm.getFile().extractedQlTest()) and
+ not exists(MethodImplementation better | mi.getMethod() = better.getMethod() |
+ mi.getNumberOfInstructions() < better.getNumberOfInstructions()
+ or
+ mi.getNumberOfInstructions() = better.getNumberOfInstructions() and
+ asm.getFile().toString() > better.getLocation().getFile().toString()
+ ) and
+ exists(mi.getAnInstruction())
+ )
}
}
diff --git a/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll b/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll
index 9ca724cb08d..683ee6268aa 100644
--- a/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll
+++ b/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll
@@ -68,9 +68,8 @@ private module Cached {
Definition getAPhiInput(PhiNode phi) { phiHasInputFromBlock(phi, result, _) }
cached
- predicate hasLastInputRef(Definition phi, Definition def, BasicBlock bb, int i) {
- lastRefRedef(def, bb, i, phi) and
- def = getAPhiInput(phi)
+ predicate lastRefBeforeRedef(Definition def, BasicBlock bb, int i, Definition next) {
+ lastRefRedef(def, bb, i, next)
}
}
diff --git a/csharp/ql/lib/semmle/code/csharp/AnnotatedType.qll b/csharp/ql/lib/semmle/code/csharp/AnnotatedType.qll
index 8afdbd0d4a3..57221e47aa9 100644
--- a/csharp/ql/lib/semmle/code/csharp/AnnotatedType.qll
+++ b/csharp/ql/lib/semmle/code/csharp/AnnotatedType.qll
@@ -191,7 +191,7 @@ private module Annotations {
NoNullability() { not nullability_parent(_, _, nullability) }
}
- /** A type with annotated nullablity, `?`. */
+ /** A type with annotated nullability, `?`. */
class AnnotatedNullability extends Nullability {
AnnotatedNullability() { nullability instanceof @annotated }
diff --git a/csharp/ql/lib/semmle/code/csharp/Assignable.qll b/csharp/ql/lib/semmle/code/csharp/Assignable.qll
index ede365ccf75..975f69edaa9 100644
--- a/csharp/ql/lib/semmle/code/csharp/Assignable.qll
+++ b/csharp/ql/lib/semmle/code/csharp/Assignable.qll
@@ -111,6 +111,7 @@ class AssignableRead extends AssignableAccess {
* - The reads of `i` on lines 7 and 8 are next to the read on line 6.
* - The read of `this.Field` on line 11 is next to the read on line 10.
*/
+ pragma[nomagic]
AssignableRead getANextRead() {
forex(ControlFlow::Node cfn | cfn = result.getAControlFlowNode() |
cfn = this.getAnAdjacentReadSameVar()
@@ -124,7 +125,7 @@ class AssignableRead extends AssignableAccess {
*
* This is the transitive closure of `getANextRead()`.
*/
- AssignableRead getAReachableRead() { result = this.getANextRead+() }
+ deprecated AssignableRead getAReachableRead() { result = this.getANextRead+() }
}
/**
@@ -479,6 +480,7 @@ class AssignableDefinition extends TAssignableDefinition {
* Subsequent reads can be found by following the steps defined by
* `AssignableRead.getANextRead()`.
*/
+ pragma[nomagic]
AssignableRead getAFirstRead() {
forex(ControlFlow::Node cfn | cfn = result.getAControlFlowNode() |
exists(Ssa::ExplicitDefinition def | result = def.getAFirstReadAtNode(cfn) |
@@ -494,7 +496,7 @@ class AssignableDefinition extends TAssignableDefinition {
*
* This is the equivalent with `getAFirstRead().getANextRead*()`.
*/
- AssignableRead getAReachableRead() { result = this.getAFirstRead().getANextRead*() }
+ deprecated AssignableRead getAReachableRead() { result = this.getAFirstRead().getANextRead*() }
/** Gets a textual representation of this assignable definition. */
string toString() { none() }
diff --git a/csharp/ql/lib/semmle/code/csharp/Conversion.qll b/csharp/ql/lib/semmle/code/csharp/Conversion.qll
index d62055b6a17..81282769acf 100644
--- a/csharp/ql/lib/semmle/code/csharp/Conversion.qll
+++ b/csharp/ql/lib/semmle/code/csharp/Conversion.qll
@@ -517,7 +517,7 @@ predicate convNullableType(ValueOrRefType fromType, NullableType toType) {
/**
* Holds if `fromType` is `NullType`, and `toType` is a type that can represent
* the `null` value, such as a reference type, `Nullable` or a type parameter
- * with contraints that restrict it to a reference type.
+ * with constraints that restrict it to a reference type.
*/
// This is a deliberate, small Cartesian product, so we have manually lifted it to force the
// evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
diff --git a/csharp/ql/lib/semmle/code/csharp/Location.qll b/csharp/ql/lib/semmle/code/csharp/Location.qll
index 22d87f42424..8b4fabb44e7 100644
--- a/csharp/ql/lib/semmle/code/csharp/Location.qll
+++ b/csharp/ql/lib/semmle/code/csharp/Location.qll
@@ -125,7 +125,7 @@ class Version extends string {
/**
* Gets the minor version, for example `3` in `1.2.3.4`.
- * If the minor version is unspecifed, then the result is `0`.
+ * If the minor version is unspecified, then the result is `0`.
*/
bindingset[this]
int getMinor() { result = this.getField(3) }
diff --git a/csharp/ql/lib/semmle/code/csharp/Property.qll b/csharp/ql/lib/semmle/code/csharp/Property.qll
index 1bd65425845..94aecf65637 100644
--- a/csharp/ql/lib/semmle/code/csharp/Property.qll
+++ b/csharp/ql/lib/semmle/code/csharp/Property.qll
@@ -136,7 +136,7 @@ class Property extends DotNet::Property, DeclarationWithGetSetAccessors, @proper
* }
* ```
*
- * Note that this information is only avaiable for properties in source
+ * Note that this information is only available for properties in source
* code.
*/
predicate isAutoImplemented() {
diff --git a/csharp/ql/lib/semmle/code/csharp/commons/Disposal.qll b/csharp/ql/lib/semmle/code/csharp/commons/Disposal.qll
index 090599a60a7..f3c1c7a3c78 100644
--- a/csharp/ql/lib/semmle/code/csharp/commons/Disposal.qll
+++ b/csharp/ql/lib/semmle/code/csharp/commons/Disposal.qll
@@ -11,15 +11,19 @@ private predicate isDisposeMethod(DotNet::Callable method) {
method.getNumberOfParameters() = 0
}
-private predicate cilVariableReadFlowsTo(CIL::Variable variable, CIL::DataFlowNode n) {
- n = variable.getARead()
+private predicate cilVariableReadFlowsToNode(CIL::Variable variable, DataFlow::Node n) {
+ n.asExpr() = variable.getARead()
or
- exists(CIL::DataFlowNode mid |
- cilVariableReadFlowsTo(variable, mid) and
- mid.getALocalFlowSucc(n, any(CIL::Untainted u))
+ exists(DataFlow::Node mid |
+ cilVariableReadFlowsToNode(variable, mid) and
+ DataFlow::localFlowStep(mid, n)
)
}
+private predicate cilVariableReadFlowsTo(CIL::Variable variable, CIL::DataFlowNode n) {
+ cilVariableReadFlowsToNode(variable, DataFlow::exprNode(n))
+}
+
private predicate disposedCilVariable(CIL::Variable variable) {
// `variable` is the `this` parameter on a dispose method.
isDisposeMethod(variable.(CIL::ThisParameter).getMethod())
diff --git a/csharp/ql/lib/semmle/code/csharp/commons/GeneratedCode.qll b/csharp/ql/lib/semmle/code/csharp/commons/GeneratedCode.qll
index 38d559d8ffd..7da80a79ffd 100644
--- a/csharp/ql/lib/semmle/code/csharp/commons/GeneratedCode.qll
+++ b/csharp/ql/lib/semmle/code/csharp/commons/GeneratedCode.qll
@@ -44,7 +44,7 @@ class GeneratedNamespaceFile extends GeneratedCodeFile {
}
}
-/** A file contining comments suggesting it contains generated code. */
+/** A file continuing comments suggesting it contains generated code. */
class GeneratedCommentFile extends GeneratedCodeFile {
GeneratedCommentFile() { this = any(GeneratedCodeComment c).getLocation().getFile() }
}
diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll
index 2f104dae88c..5b210a4004d 100644
--- a/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll
+++ b/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll
@@ -1470,7 +1470,7 @@ module Internal {
)
}
- private predicate firstReadSameVarUniquePredecesssor(
+ private predicate firstReadSameVarUniquePredecessor(
PreSsa::Definition def, AssignableRead read
) {
read = def.getAFirstRead() and
@@ -1603,7 +1603,7 @@ module Internal {
g1 = def.getARead() and
isGuard(g1, v1) and
v2 = v1 and
- if v1.isReferentialProperty() then firstReadSameVarUniquePredecesssor(def, g1) else any()
+ if v1.isReferentialProperty() then firstReadSameVarUniquePredecessor(def, g1) else any()
)
or
exists(PreSsa::Definition def, AbstractValue v |
@@ -1684,7 +1684,7 @@ module Internal {
mid = e.(Cast).getExpr()
)
or
- exists(PreSsa::Definition def | emptyDef(def) | firstReadSameVarUniquePredecesssor(def, e))
+ exists(PreSsa::Definition def | emptyDef(def) | firstReadSameVarUniquePredecessor(def, e))
or
exists(MethodCall mc |
mc.getTarget().getAnUltimateImplementee().getUnboundDeclaration() =
@@ -1708,7 +1708,7 @@ module Internal {
)
or
exists(PreSsa::Definition def | nonEmptyDef(def) |
- firstReadSameVarUniquePredecesssor(def, e)
+ firstReadSameVarUniquePredecessor(def, e)
)
or
exists(MethodCall mc |
diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll
index 7d0dd10c084..dbd90ba0ae1 100644
--- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll
+++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll
@@ -885,7 +885,7 @@ module TestOutput {
/**
* Gets a string used to resolve ties in node and edge ordering.
*/
- string getOrderDisambuigation() { result = "" }
+ string getOrderDisambiguation() { result = "" }
}
query predicate nodes(RelevantNode n, string attr, string val) {
@@ -900,7 +900,7 @@ module TestOutput {
order by
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString(),
- p.getOrderDisambuigation()
+ p.getOrderDisambiguation()
)
).toString()
}
@@ -923,7 +923,7 @@ module TestOutput {
order by
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString(),
- s.getOrderDisambuigation()
+ s.getOrderDisambiguation()
)
).toString()
}
diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreBasicBlocks.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreBasicBlocks.qll
index de44808b18e..095c4e69498 100644
--- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreBasicBlocks.qll
+++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreBasicBlocks.qll
@@ -3,7 +3,7 @@
*
* Provides a basic block implementation on control flow elements. That is,
* a "pre-CFG" where the nodes are (unsplit) control flow elements and the
- * successor releation is `succ = succ(pred, _)`.
+ * successor relation is `succ = succ(pred, _)`.
*
* The logic is duplicated from the implementation in `BasicBlocks.qll`, and
* being an internal class, all predicate documentation has been removed.
diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/Splitting.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/Splitting.qll
index 02fb893cb7f..f7c84dbac5f 100644
--- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/Splitting.qll
+++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/Splitting.qll
@@ -911,7 +911,7 @@ module BooleanSplitting {
* ```
*
* the branch taken in the condition on line 2 can be recorded, and the
- * recorded value will detmine the branch taken in the condition on line 4.
+ * recorded value will determine the branch taken in the condition on line 4.
*/
abstract predicate correlatesConditions(ConditionBlock cb1, ConditionBlock cb2, boolean inverted);
diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/SuccessorType.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/SuccessorType.qll
index 154ab9423b9..d6ea2161bbb 100644
--- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/SuccessorType.qll
+++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/SuccessorType.qll
@@ -126,7 +126,7 @@ module SuccessorTypes {
* }
* ```
*
- * has a control flow graph containing macthing successors:
+ * has a control flow graph containing matching successors:
*
* ```
* switch
@@ -230,7 +230,7 @@ module SuccessorTypes {
* }
* ```
*
- * The node `return x;` is a `break` succedssor of the node `break;`.
+ * The node `return x;` is a `break` successor of the node `break;`.
*/
class BreakSuccessor extends SuccessorType, TBreakSuccessor {
override string toString() { result = "break" }
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/FlowSummary.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/FlowSummary.qll
index 08a9a8a5421..8695563f160 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/FlowSummary.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/FlowSummary.qll
@@ -97,7 +97,7 @@ module SummaryComponentStack {
result = push(SummaryComponent::element(), container)
}
- /** Gets a stack representing a propery `p` of `object`. */
+ /** Gets a stack representing a property `p` of `object`. */
SummaryComponentStack propertyOf(Property p, SummaryComponentStack object) {
result = push(SummaryComponent::property(p), object)
}
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll
index 67e93ea7f6f..b5631b26b0b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
/**
* Holds if data may flow from some source to `sink` for this configuration.
*/
- predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
+ predicate hasFlowTo(Node sink) {
+ sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
+ }
/**
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
* by `revFlow`.
*/
pragma[nomagic]
- predicate revFlowIsReadAndStored(Content c, Configuration conf) {
+ additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
revFlowConsCand(c, conf) and
revFlowStore(c, _, _, conf)
}
pragma[nomagic]
- predicate viableReturnPosOutNodeCandFwd1(
+ additional predicate viableReturnPosOutNodeCandFwd1(
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
) {
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
}
pragma[nomagic]
- predicate viableParamArgNodeCandFwd1(
+ additional predicate viableParamArgNodeCandFwd1(
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
) {
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
)
}
- predicate revFlowState(FlowState state, Configuration config) {
+ additional predicate revFlowState(FlowState state, Configuration config) {
exists(NodeEx node |
sinkNode(node, state, config) and
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage {
* argument.
*/
pragma[nomagic]
- predicate fwdFlow(
+ additional predicate fwdFlow(
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
) {
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage {
* the access path of the returned value.
*/
pragma[nomagic]
- predicate revFlow(
+ additional predicate revFlow(
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
) {
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage {
)
}
- predicate revFlow(NodeEx node, FlowState state, Configuration config) {
+ additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
revFlow(node, state, _, _, _, config)
}
@@ -1673,11 +1675,13 @@ private module MkStage {
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
+ additional predicate revFlowAlias(NodeEx node, Configuration config) {
+ revFlow(node, _, _, _, _, config)
+ }
// use an alias as a workaround for bad functionality-induced joins
pragma[nomagic]
- predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
+ additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
revFlow(node, state, ap, config)
}
@@ -1698,7 +1702,7 @@ private module MkStage {
)
}
- predicate consCand(TypedContent tc, Ap ap, Configuration config) {
+ additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
revConsCand(tc, ap, config) and
validAp(ap, config)
}
@@ -1740,7 +1744,7 @@ private module MkStage {
)
}
- predicate stats(
+ additional predicate stats(
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
) {
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
result = this.getASuccessorImpl()
}
- final PathNodeImpl getANonHiddenSuccessor() {
- result = this.getASuccessorImpl().getASuccessorIfHidden*() and
- not this.isHidden() and
+ pragma[nomagic]
+ private PathNodeImpl getANonHiddenSuccessor0() {
+ result = this.getASuccessorIfHidden*() and
not result.isHidden()
}
+ final PathNodeImpl getANonHiddenSuccessor() {
+ result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
+ not this.isHidden()
+ }
+
abstract NodeEx getNodeEx();
predicate isHidden() {
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll
index 5d455e6b387..dbea34f039b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll
@@ -17,6 +17,7 @@ private import semmle.code.csharp.frameworks.EntityFramework
private import semmle.code.csharp.frameworks.NHibernate
private import semmle.code.csharp.frameworks.system.Collections
private import semmle.code.csharp.frameworks.system.threading.Tasks
+private import semmle.code.cil.Ssa::Ssa as CilSsa
/** Gets the callable in which this node occurs. */
DataFlowCallable nodeGetEnclosingCallable(NodeImpl n) { result = n.getEnclosingCallableImpl() }
@@ -177,6 +178,12 @@ predicate hasNodePath(ControlFlowReachabilityConfiguration conf, ExprNode n1, No
)
}
+/** Gets the CIL data-flow node for `node`, if any. */
+CIL::DataFlowNode asCilDataFlowNode(Node node) {
+ result = node.asParameter() or
+ result = node.asExpr()
+}
+
/** Provides predicates related to local data flow. */
module LocalFlow {
private class LocalExprStepConfiguration extends ControlFlowReachabilityConfiguration {
@@ -281,15 +288,6 @@ module LocalFlow {
}
}
- private CIL::DataFlowNode asCilDataFlowNode(Node node) {
- result = node.asParameter() or
- result = node.asExpr()
- }
-
- private predicate localFlowStepCil(Node nodeFrom, Node nodeTo) {
- asCilDataFlowNode(nodeFrom).getALocalFlowSucc(asCilDataFlowNode(nodeTo), any(CIL::Untainted t))
- }
-
/**
* An uncertain SSA definition. Either an uncertain explicit definition or an
* uncertain qualifier definition.
@@ -341,7 +339,7 @@ module LocalFlow {
/**
* Holds if there is a local flow step from `nodeFrom` to `nodeTo` involving
- * SSA definition `def.
+ * SSA definition `def`.
*/
predicate localSsaFlowStep(Ssa::Definition def, Node nodeFrom, Node nodeTo) {
// Flow from SSA definition/parameter to first read
@@ -386,6 +384,76 @@ module LocalFlow {
)
}
+ private module CilFlow {
+ private import semmle.code.cil.internal.SsaImpl as CilSsaImpl
+
+ /**
+ * Holds if `nodeFrom` is a last node referencing SSA definition `def`, which
+ * can reach `next`.
+ */
+ private predicate localFlowCilSsaInput(
+ Node nodeFrom, CilSsa::Definition def, CilSsa::Definition next
+ ) {
+ exists(CIL::BasicBlock bb, int i | CilSsaImpl::lastRefBeforeRedef(def, bb, i, next) |
+ def.definesAt(_, bb, i) and
+ def = nodeFrom.(CilSsaDefinitionNode).getDefinition()
+ or
+ nodeFrom = TCilExprNode(bb.getNode(i).(CIL::ReadAccess))
+ )
+ }
+
+ /**
+ * Holds if there is a local flow step from `nodeFrom` to `nodeTo` involving
+ * CIL SSA definition `def`.
+ */
+ private predicate localCilSsaFlowStep(CilSsa::Definition def, Node nodeFrom, Node nodeTo) {
+ // Flow into SSA definition
+ exists(CIL::VariableUpdate vu |
+ vu = def.getVariableUpdate() and
+ vu.getSource() = asCilDataFlowNode(nodeFrom) and
+ def = nodeTo.(CilSsaDefinitionNode).getDefinition()
+ )
+ or
+ // Flow from SSA definition to first read
+ def = nodeFrom.(CilSsaDefinitionNode).getDefinition() and
+ nodeTo = TCilExprNode(CilSsaImpl::getAFirstRead(def))
+ or
+ // Flow from read to next read
+ exists(CIL::ReadAccess readFrom, CIL::ReadAccess readTo |
+ CilSsaImpl::hasAdjacentReads(def, readFrom, readTo) and
+ nodeTo = TCilExprNode(readTo) and
+ nodeFrom = TCilExprNode(readFrom)
+ )
+ or
+ // Flow into phi node
+ exists(CilSsa::PhiNode phi |
+ localFlowCilSsaInput(nodeFrom, def, phi) and
+ phi = nodeTo.(CilSsaDefinitionNode).getDefinition() and
+ def = CilSsaImpl::getAPhiInput(phi)
+ )
+ }
+
+ private predicate localExactStep(CIL::DataFlowNode src, CIL::DataFlowNode sink) {
+ src = sink.(CIL::Opcodes::Dup).getAnOperand()
+ or
+ src = sink.(CIL::Conversion).getExpr()
+ or
+ src = sink.(CIL::WriteAccess).getExpr()
+ or
+ src = sink.(CIL::Method).getAnImplementation().getAnInstruction().(CIL::Return)
+ or
+ src = sink.(CIL::Return).getExpr()
+ or
+ src = sink.(CIL::ConditionalBranch).getAnOperand()
+ }
+
+ predicate localFlowStepCil(Node nodeFrom, Node nodeTo) {
+ localExactStep(asCilDataFlowNode(nodeFrom), asCilDataFlowNode(nodeTo))
+ or
+ localCilSsaFlowStep(_, nodeFrom, nodeTo)
+ }
+ }
+
predicate localFlowStepCommon(Node nodeFrom, Node nodeTo) {
exists(Ssa::Definition def |
localSsaFlowStep(def, nodeFrom, nodeTo) and
@@ -398,7 +466,7 @@ module LocalFlow {
or
ThisFlow::adjacentThisRefs(nodeFrom.(PostUpdateNode).getPreUpdateNode(), nodeTo)
or
- localFlowStepCil(nodeFrom, nodeTo)
+ CilFlow::localFlowStepCil(nodeFrom, nodeTo)
}
/**
@@ -634,7 +702,7 @@ private predicate arrayStore(Expr e, Expr src, Expr a, boolean postUpdate) {
e = a and
postUpdate = false
or
- // Member initalizer, `new C { Array = { [i] = src } }`
+ // Member initializer, `new C { Array = { [i] = src } }`
exists(MemberInitializer mi |
mi = a.(ObjectInitializer).getAMemberInitializer() and
mi.getLValue() instanceof ArrayAccess and
@@ -719,6 +787,7 @@ private module Cached {
cfn.getElement() instanceof Expr
} or
TCilExprNode(CIL::Expr e) { e.getImplementation() instanceof CIL::BestImplementation } or
+ TCilSsaDefinitionNode(CilSsa::Definition def) or
TSsaDefinitionNode(Ssa::Definition def) {
// Handled by `TExplicitParameterNode` below
not def.(Ssa::ExplicitDefinition).getADefinition() instanceof
@@ -867,6 +936,28 @@ predicate nodeIsHidden(Node n) {
n.asExpr() = any(WithExpr we).getInitializer()
}
+/** A CIL SSA definition, viewed as a node in a data flow graph. */
+class CilSsaDefinitionNode extends NodeImpl, TCilSsaDefinitionNode {
+ CilSsa::Definition def;
+
+ CilSsaDefinitionNode() { this = TCilSsaDefinitionNode(def) }
+
+ /** Gets the underlying SSA definition. */
+ CilSsa::Definition getDefinition() { result = def }
+
+ override DataFlowCallable getEnclosingCallableImpl() {
+ result.asCallable() = def.getBasicBlock().getFirstNode().getImplementation().getMethod()
+ }
+
+ override CIL::Type getTypeImpl() { result = def.getSourceVariable().getType() }
+
+ override ControlFlow::Node getControlFlowNodeImpl() { none() }
+
+ override Location getLocationImpl() { result = def.getBasicBlock().getLocation() }
+
+ override string toStringImpl() { result = def.toString() }
+}
+
/** An SSA definition, viewed as a node in a data flow graph. */
class SsaDefinitionNode extends NodeImpl, TSsaDefinitionNode {
Ssa::Definition def;
@@ -1581,6 +1672,8 @@ predicate jumpStep(Node pred, Node succ) {
jrk.getTarget() = call.getATarget(_) and
succ = getAnOutNode(call, jrk.getTargetReturnKind())
)
+ or
+ FlowSummaryImpl::Private::Steps::summaryJumpStep(pred, succ)
}
private class StoreStepConfiguration extends ControlFlowReachabilityConfiguration {
@@ -1945,8 +2038,8 @@ private module PostUpdateNodes {
ExprPostUpdateNode() { this = TExprPostUpdateNode(cfn) }
override ExprNode getPreUpdateNode() {
- // For compund arguments, such as `m(b ? x : y)`, we want the leaf nodes
- // `[post] x` and `[post] y` to have two pre-update nodes: (1) the compund argument,
+ // For compound arguments, such as `m(b ? x : y)`, we want the leaf nodes
+ // `[post] x` and `[post] y` to have two pre-update nodes: (1) the compound argument,
// `if b then x else y`; and the (2) the underlying expressions; `x` and `y`,
// respectively.
//
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPublic.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPublic.qll
index a70bffabfdb..f6520147e19 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPublic.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPublic.qll
@@ -161,7 +161,7 @@ predicate localFlow(Node source, Node sink) { localFlowStep*(source, sink) }
* local (intra-procedural) steps.
*/
pragma[inline]
-predicate localExprFlow(Expr e1, Expr e2) { localFlow(exprNode(e1), exprNode(e2)) }
+predicate localExprFlow(DotNet::Expr e1, DotNet::Expr e2) { localFlow(exprNode(e1), exprNode(e2)) }
/**
* A data flow node that jumps between callables. This can be extended in
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll
index d857cdaa359..275569b4c02 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll
@@ -61,6 +61,20 @@ module Public {
/** Gets a summary component for a return of kind `rk`. */
SummaryComponent return(ReturnKind rk) { result = TReturnSummaryComponent(rk) }
+
+ /** Gets a summary component for synthetic global `sg`. */
+ SummaryComponent syntheticGlobal(SyntheticGlobal sg) {
+ result = TSyntheticGlobalSummaryComponent(sg)
+ }
+
+ /**
+ * A synthetic global. This represents some form of global state, which
+ * summaries can read and write individually.
+ */
+ abstract class SyntheticGlobal extends string {
+ bindingset[this]
+ SyntheticGlobal() { any() }
+ }
}
/**
@@ -256,6 +270,7 @@ module Private {
TParameterSummaryComponent(ArgumentPosition pos) or
TArgumentSummaryComponent(ParameterPosition pos) or
TReturnSummaryComponent(ReturnKind rk) or
+ TSyntheticGlobalSummaryComponent(SummaryComponent::SyntheticGlobal sg) or
TWithoutContentSummaryComponent(ContentSet c) or
TWithContentSummaryComponent(ContentSet c)
@@ -563,6 +578,11 @@ module Private {
getCallbackReturnType(getNodeType(summaryNodeInputState(pragma[only_bind_out](c),
s.tail())), rk)
)
+ or
+ exists(SummaryComponent::SyntheticGlobal sg |
+ head = TSyntheticGlobalSummaryComponent(sg) and
+ result = getSyntheticGlobalType(sg)
+ )
)
or
n = summaryNodeOutputState(c, s) and
@@ -582,6 +602,11 @@ module Private {
getCallbackParameterType(getNodeType(summaryNodeInputState(pragma[only_bind_out](c),
s.tail())), pos)
)
+ or
+ exists(SummaryComponent::SyntheticGlobal sg |
+ head = TSyntheticGlobalSummaryComponent(sg) and
+ result = getSyntheticGlobalType(sg)
+ )
)
)
}
@@ -692,6 +717,18 @@ module Private {
)
}
+ /**
+ * Holds if there is a jump step from `pred` to `succ`, which is synthesized
+ * from a flow summary.
+ */
+ predicate summaryJumpStep(Node pred, Node succ) {
+ exists(SummaryComponentStack s |
+ s = SummaryComponentStack::singleton(SummaryComponent::syntheticGlobal(_)) and
+ pred = summaryNodeOutputState(_, s) and
+ succ = summaryNodeInputState(_, s)
+ )
+ }
+
/**
* Holds if values stored inside content `c` are cleared at `n`. `n` is a
* synthesized summary node, so in order for values to be cleared at calls
@@ -750,6 +787,27 @@ module Private {
)
}
+ /**
+ * Holds if `p` can reach `n` in a summarized callable, using only value-preserving
+ * local steps. `clearsOrExpects` records whether any node on the path from `p` to
+ * `n` either clears or expects contents.
+ */
+ private predicate paramReachesLocal(ParamNode p, Node n, boolean clearsOrExpects) {
+ viableParam(_, _, _, p) and
+ n = p and
+ clearsOrExpects = false
+ or
+ exists(Node mid, boolean clearsOrExpectsMid |
+ paramReachesLocal(p, mid, clearsOrExpectsMid) and
+ summaryLocalStep(mid, n, true) and
+ if
+ summaryClearsContent(n, _) or
+ summaryExpectsContent(n, _)
+ then clearsOrExpects = true
+ else clearsOrExpects = clearsOrExpectsMid
+ )
+ }
+
/**
* Holds if use-use flow starting from `arg` should be prohibited.
*
@@ -759,15 +817,11 @@ module Private {
*/
pragma[nomagic]
predicate prohibitsUseUseFlow(ArgNode arg, SummarizedCallable sc) {
- exists(ParamNode p, Node mid, ParameterPosition ppos, Node ret |
+ exists(ParamNode p, ParameterPosition ppos, Node ret |
+ paramReachesLocal(p, ret, true) and
p = summaryArgParam0(_, arg, sc) and
p.isParameterOf(_, pragma[only_bind_into](ppos)) and
- summaryLocalStep(p, mid, true) and
- summaryLocalStep(mid, ret, true) and
isParameterPostUpdate(ret, _, pragma[only_bind_into](ppos))
- |
- summaryClearsContent(mid, _) or
- summaryExpectsContent(mid, _)
)
}
@@ -854,18 +908,28 @@ module Private {
AccessPathRange() { relevantSpec(this) }
}
- /** Holds if specification component `c` parses as parameter `n`. */
+ /** Holds if specification component `token` parses as parameter `pos`. */
predicate parseParam(AccessPathToken token, ArgumentPosition pos) {
token.getName() = "Parameter" and
pos = parseParamBody(token.getAnArgument())
}
- /** Holds if specification component `c` parses as argument `n`. */
+ /** Holds if specification component `token` parses as argument `pos`. */
predicate parseArg(AccessPathToken token, ParameterPosition pos) {
token.getName() = "Argument" and
pos = parseArgBody(token.getAnArgument())
}
+ /** Holds if specification component `token` parses as synthetic global `sg`. */
+ predicate parseSynthGlobal(AccessPathToken token, string sg) {
+ token.getName() = "SyntheticGlobal" and
+ sg = token.getAnArgument()
+ }
+
+ private class SyntheticGlobalFromAccessPath extends SummaryComponent::SyntheticGlobal {
+ SyntheticGlobalFromAccessPath() { parseSynthGlobal(_, this) }
+ }
+
private SummaryComponent interpretComponent(AccessPathToken token) {
exists(ParameterPosition pos |
parseArg(token, pos) and result = SummaryComponent::argument(pos)
@@ -877,6 +941,10 @@ module Private {
or
token = "ReturnValue" and result = SummaryComponent::return(getReturnValueKind())
or
+ exists(string sg |
+ parseSynthGlobal(token, sg) and result = SummaryComponent::syntheticGlobal(sg)
+ )
+ or
result = interpretComponentSpecific(token)
}
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImplSpecific.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImplSpecific.qll
index 864fda40cf7..93cd70f63c2 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImplSpecific.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImplSpecific.qll
@@ -91,6 +91,12 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) {
)
}
+/** Gets the type of synthetic global `sg`. */
+DataFlowType getSyntheticGlobalType(SummaryComponent::SyntheticGlobal sg) {
+ exists(sg) and
+ result = Gvn::getGlobalValueNumber(any(ObjectType t))
+}
+
bindingset[provenance]
private boolean isGenerated(string provenance) {
provenance = "generated" and result = true
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll
index 0655ffee6f9..9ff6888d6e4 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll
@@ -803,14 +803,14 @@ private module CapturedVariableImpl {
* Holds if `c` is a relevant part of the call graph for
* `updatesCapturedVariable` based on following edges in forward direction.
*/
- private predicate reachbleFromSource(Callable c) {
+ private predicate reachableFromSource(Callable c) {
source(_, _, _, c, _)
or
- exists(Callable mid | reachbleFromSource(mid) | callEdge(mid, c))
+ exists(Callable mid | reachableFromSource(mid) | callEdge(mid, c))
}
private predicate sink(Callable c, CapturedWrittenLocalScopeVariable captured) {
- reachbleFromSource(c) and
+ reachableFromSource(c) and
relevantDefinition(c, captured, _)
}
@@ -932,14 +932,14 @@ private module CapturedVariableLivenessImpl {
* Holds if `c` is a relevant part of the call graph for
* `readsCapturedVariable` based on following edges in forward direction.
*/
- private predicate reachbleFromSource(Callable c) {
+ private predicate reachableFromSource(Callable c) {
source(_, _, _, c, _)
or
- exists(Callable mid | reachbleFromSource(mid) | callEdge(mid, c))
+ exists(Callable mid | reachableFromSource(mid) | callEdge(mid, c))
}
private predicate sink(Callable c, CapturedReadLocalScopeVariable captured) {
- reachbleFromSource(c) and
+ reachableFromSource(c) and
capturerReads(c, captured)
}
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/Steps.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/Steps.qll
index 77a21025840..6d5443d480b 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/Steps.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/Steps.qll
@@ -53,12 +53,12 @@ module Steps {
private predicate flowIn(Parameter p, Expr pred, AssignableRead succ) {
exists(AssignableDefinitions::ImplicitParameterDefinition def, Call c | succ = getARead(def) |
- pred = getArgumentForOverridderParameter(c, p) and
+ pred = getArgumentForOverriderParameter(c, p) and
p.getUnboundDeclaration() = def.getParameter()
)
}
- private Expr getArgumentForOverridderParameter(Call call, Parameter p) {
+ private Expr getArgumentForOverriderParameter(Call call, Parameter p) {
exists(Parameter base, Callable callable | result = call.getArgumentForParameter(base) |
base = callable.getAParameter() and
isOverriderParameter(callable, p, base.getPosition())
diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/TaintTrackingPrivate.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/TaintTrackingPrivate.qll
index ec29d704248..4f823907f94 100644
--- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/TaintTrackingPrivate.qll
+++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/TaintTrackingPrivate.qll
@@ -26,13 +26,14 @@ predicate defaultTaintSanitizer(DataFlow::Node node) { none() }
bindingset[node]
predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::Content c) { none() }
-private CIL::DataFlowNode asCilDataFlowNode(DataFlow::Node node) {
- result = node.asParameter() or
- result = node.asExpr()
+private predicate localCilTaintStep(CIL::DataFlowNode src, CIL::DataFlowNode sink) {
+ src = sink.(CIL::BinaryArithmeticExpr).getAnOperand() or
+ src = sink.(CIL::Opcodes::Neg).getOperand() or
+ src = sink.(CIL::UnaryBitwiseOperation).getOperand()
}
private predicate localTaintStepCil(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
- asCilDataFlowNode(nodeFrom).getALocalFlowSucc(asCilDataFlowNode(nodeTo), any(CIL::Tainted t))
+ localCilTaintStep(asCilDataFlowNode(nodeFrom), asCilDataFlowNode(nodeTo))
}
private class LocalTaintExprStepConfiguration extends ControlFlowReachabilityConfiguration {
diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/Access.qll b/csharp/ql/lib/semmle/code/csharp/exprs/Access.qll
index 9d7cf3a5867..3e3c8ca79e8 100644
--- a/csharp/ql/lib/semmle/code/csharp/exprs/Access.qll
+++ b/csharp/ql/lib/semmle/code/csharp/exprs/Access.qll
@@ -174,7 +174,9 @@ class VariableAccess extends AssignableAccess, @variable_access_expr {
class VariableRead extends VariableAccess, AssignableRead {
override VariableRead getANextRead() { result = AssignableRead.super.getANextRead() }
- override VariableRead getAReachableRead() { result = AssignableRead.super.getAReachableRead() }
+ deprecated override VariableRead getAReachableRead() {
+ result = AssignableRead.super.getAReachableRead()
+ }
}
/**
@@ -200,7 +202,7 @@ class LocalScopeVariableAccess extends VariableAccess, @local_scope_variable_acc
class LocalScopeVariableRead extends LocalScopeVariableAccess, VariableRead {
override LocalScopeVariableRead getANextRead() { result = VariableRead.super.getANextRead() }
- override LocalScopeVariableRead getAReachableRead() {
+ deprecated override LocalScopeVariableRead getAReachableRead() {
result = VariableRead.super.getAReachableRead()
}
}
@@ -242,7 +244,7 @@ class ParameterAccess extends LocalScopeVariableAccess, @parameter_access_expr {
class ParameterRead extends ParameterAccess, LocalScopeVariableRead {
override ParameterRead getANextRead() { result = LocalScopeVariableRead.super.getANextRead() }
- override ParameterRead getAReachableRead() {
+ deprecated override ParameterRead getAReachableRead() {
result = LocalScopeVariableRead.super.getAReachableRead()
}
}
@@ -297,7 +299,7 @@ class LocalVariableAccess extends LocalScopeVariableAccess, @local_variable_acce
class LocalVariableRead extends LocalVariableAccess, LocalScopeVariableRead {
override LocalVariableRead getANextRead() { result = LocalScopeVariableRead.super.getANextRead() }
- override LocalVariableRead getAReachableRead() {
+ deprecated override LocalVariableRead getAReachableRead() {
result = LocalScopeVariableRead.super.getAReachableRead()
}
}
@@ -442,7 +444,9 @@ class PropertyAccess extends AssignableMemberAccess, PropertyAccessExpr {
class PropertyRead extends PropertyAccess, AssignableRead {
override PropertyRead getANextRead() { result = AssignableRead.super.getANextRead() }
- override PropertyRead getAReachableRead() { result = AssignableRead.super.getAReachableRead() }
+ deprecated override PropertyRead getAReachableRead() {
+ result = AssignableRead.super.getAReachableRead()
+ }
}
/**
@@ -581,7 +585,9 @@ class IndexerAccess extends AssignableMemberAccess, ElementAccess, IndexerAccess
class IndexerRead extends IndexerAccess, ElementRead {
override IndexerRead getANextRead() { result = ElementRead.super.getANextRead() }
- override IndexerRead getAReachableRead() { result = ElementRead.super.getAReachableRead() }
+ deprecated override IndexerRead getAReachableRead() {
+ result = ElementRead.super.getAReachableRead()
+ }
}
/**
diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll b/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll
index 0ae16bb5065..a23da710465 100644
--- a/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll
+++ b/csharp/ql/lib/semmle/code/csharp/exprs/BitwiseOperation.qll
@@ -74,7 +74,7 @@ class BitwiseOrExpr extends BinaryBitwiseOperation, @bit_or_expr {
}
/**
- * A bitwise exlusive-or operation, for example `x ^ y`.
+ * A bitwise exclusive-or operation, for example `x ^ y`.
*/
class BitwiseXorExpr extends BinaryBitwiseOperation, @bit_xor_expr {
override string getOperator() { result = "^" }
diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/Call.qll b/csharp/ql/lib/semmle/code/csharp/exprs/Call.qll
index 1aa67410c59..edd7aa3932d 100644
--- a/csharp/ql/lib/semmle/code/csharp/exprs/Call.qll
+++ b/csharp/ql/lib/semmle/code/csharp/exprs/Call.qll
@@ -417,7 +417,7 @@ class ConstructorInitializer extends Call, @constructor_init_expr {
}
/**
- * Holds if this initialier is a `this` initializer, for example `this(0)`
+ * Holds if this initializer is a `this` initializer, for example `this(0)`
* in
*
* ```csharp
@@ -431,7 +431,7 @@ class ConstructorInitializer extends Call, @constructor_init_expr {
predicate isThis() { this.getTargetType() = this.getConstructorType() }
/**
- * Holds if this initialier is a `base` initializer, for example `base(0)`
+ * Holds if this initializer is a `base` initializer, for example `base(0)`
* in
*
* ```csharp
diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/Creation.qll b/csharp/ql/lib/semmle/code/csharp/exprs/Creation.qll
index b999dfbc0e7..2f090d3fd06 100644
--- a/csharp/ql/lib/semmle/code/csharp/exprs/Creation.qll
+++ b/csharp/ql/lib/semmle/code/csharp/exprs/Creation.qll
@@ -389,7 +389,7 @@ class ArrayCreation extends Expr, @array_creation_expr {
/** Holds if this array creation has an initializer. */
predicate hasInitializer() { exists(this.getInitializer()) }
- /** Gets the array initializer of this array cration, if any. */
+ /** Gets the array initializer of this array creation, if any. */
ArrayInitializer getInitializer() { result = this.getChild(-1) }
/** Holds if the type of the created array is inferred from its initializer. */
diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll b/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll
index 87fbcb8c3a9..03a24b37345 100644
--- a/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll
+++ b/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll
@@ -192,7 +192,7 @@ class Operation extends Expr, @op_expr {
}
/**
- * A unary operation. Either a unary arithemtic operation
+ * A unary operation. Either a unary arithmetic operation
* (`UnaryArithmeticOperation`), a unary bitwise operation
* (`UnaryBitwiseOperation`), a `sizeof` operation (`SizeofExpr`), a pointer
* indirection operation (`PointerIndirectionExpr`), an address-of operation
@@ -206,7 +206,7 @@ class UnaryOperation extends Operation, @un_op {
}
/**
- * A binary operation. Either a binary arithemtic operation
+ * A binary operation. Either a binary arithmetic operation
* (`BinaryArithmeticOperation`), a binary bitwise operation
* (`BinaryBitwiseOperation`), a comparison operation (`ComparisonOperation`),
* or a binary logical operation (`BinaryLogicalOperation`).
@@ -776,7 +776,7 @@ class SizeofExpr extends UnaryOperation, @sizeof_expr {
* struct A {
* public void M() { }
*
- * unsafe int DirectDerefence() {
+ * unsafe int DirectDereference() {
* int n = 10;
* int *pn = &n;
* return *pn;
@@ -788,7 +788,7 @@ class SizeofExpr extends UnaryOperation, @sizeof_expr {
* pa->M();
* }
*
- * unsafe void ArrayDerefence() {
+ * unsafe void ArrayDereference() {
* char* cp = stackalloc char[10];
* cp[1] = 'a';
* }
@@ -813,7 +813,7 @@ class PointerIndirectionExpr extends UnaryOperation, @pointer_indirection_expr {
*
* ```csharp
* class A {
- * unsafe int DirectDerefence() {
+ * unsafe int DirectDereference() {
* int n = 10;
* int *pn = &n;
* return *pn;
diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll
index 54fa60e03f2..373194ef366 100644
--- a/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll
+++ b/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll
@@ -71,6 +71,20 @@ class FormatMethod extends Method {
}
}
+pragma[nomagic]
+private predicate parameterReadPostDominatesEntry(ParameterRead pr) {
+ pr.getAControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint()) and
+ getParameterType(pr.getTarget()) instanceof ObjectType
+}
+
+pragma[nomagic]
+private predicate alwaysPassedToFormatItemParameter(ParameterRead pr) {
+ pr = any(StringFormatItemParameter other).getAnAssignedArgument() and
+ parameterReadPostDominatesEntry(pr)
+ or
+ alwaysPassedToFormatItemParameter(pr.getANextRead())
+}
+
/**
* A parameter that is used as a format item for `string.Format()`. Either a
* format item parameter of `string.Format()`, or a parameter of a method that
@@ -85,15 +99,9 @@ class StringFormatItemParameter extends Parameter {
)
or
// Parameter of a source method that forwards to `string.Format()`
- exists(
- AssignableDefinitions::ImplicitParameterDefinition def, ParameterRead pr,
- StringFormatItemParameter other
- |
+ exists(AssignableDefinitions::ImplicitParameterDefinition def |
def.getParameter() = this and
- pr = def.getAReachableRead() and
- pr.getAControlFlowNode().postDominates(this.getCallable().getEntryPoint()) and
- other.getAnAssignedArgument() = pr and
- getParameterType(this) instanceof ObjectType
+ alwaysPassedToFormatItemParameter(def.getAFirstRead())
)
}
}
diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/System.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/System.qll
index 652ec19a86a..297ae087e23 100644
--- a/csharp/ql/lib/semmle/code/csharp/frameworks/System.qll
+++ b/csharp/ql/lib/semmle/code/csharp/frameworks/System.qll
@@ -1243,7 +1243,7 @@ predicate implementsDispose(ValueOrRefType t) { getInvokedDisposeMethod(t).getDe
/**
* Gets the dispose method that will be invoked on a value `x`
- * of type `t` when `x.Dipsose()` is called.
+ * of type `t` when `x.Dispose()` is called.
*
* Either the dispose method is (an override of) `IDisposable.Dispose()`,
* or an implementation of a method `Dispose(bool)` which is called
diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll
index aaed35ef73f..d9624b60dcc 100644
--- a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll
+++ b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll
@@ -416,7 +416,7 @@ class MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions extends Class {
/** Gets the `MapDelete` extension method. */
Method getMapDeleteMethod() { result = this.getAMethod("MapDelete") }
- /** Get a `Map` like extenion methods. */
+ /** Get a `Map` like extension methods. */
Method getAMapMethod() {
result =
[
diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/Cryptography.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/Cryptography.qll
index 3a02ded5edd..9cddf3e428b 100644
--- a/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/Cryptography.qll
+++ b/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/Cryptography.qll
@@ -20,7 +20,7 @@ class SystemSecurityCryptographyClass extends Class {
}
/** Data flow for `System.Security.Cryptography.AsnEncodedDataCollection`. */
-private class SystemSecurityCryptographyAsnEncondedDataCollectionFlowModelCsv extends SummaryModelCsv {
+private class SystemSecurityCryptographyAsnEncodedDataCollectionFlowModelCsv extends SummaryModelCsv {
override predicate row(string row) {
row =
[
diff --git a/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll b/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll
index e885fdb2778..53fe605b963 100644
--- a/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll
+++ b/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll
@@ -130,7 +130,7 @@ module XmlSettings {
|
not isSafeDtdSetting(dtdVal) and evidence = dtdVal
) and
- reason = "DTD procesing enabled in settings"
+ reason = "DTD processing enabled in settings"
or
not exists(getAValueForProp(creation, "ProhibitDtd")) and
reason = "DTD processing is enabled by default in versions before 4.0" and
diff --git a/csharp/ql/src/API Abuse/ClassDoesNotImplementEquals.ql b/csharp/ql/src/API Abuse/ClassDoesNotImplementEquals.ql
index 5d08222885e..0539cd27a66 100644
--- a/csharp/ql/src/API Abuse/ClassDoesNotImplementEquals.ql
+++ b/csharp/ql/src/API Abuse/ClassDoesNotImplementEquals.ql
@@ -23,9 +23,9 @@ where
exists(MethodCall callToEquals |
callToEquals.getTarget() instanceof EqualsMethod and
callToEquals.getQualifier().getType() = c and
- message = "but it is called $@" and
+ message = "but $@" and
item = callToEquals and
- itemText = "here"
+ itemText = "'Equals' is called on an instance of this class"
)
or
item = c.getAnOperator().(EQOperator) and
diff --git a/csharp/ql/src/API Abuse/DisposeNotCalledOnException.ql b/csharp/ql/src/API Abuse/DisposeNotCalledOnException.ql
index abb962449b9..3349ee93251 100644
--- a/csharp/ql/src/API Abuse/DisposeNotCalledOnException.ql
+++ b/csharp/ql/src/API Abuse/DisposeNotCalledOnException.ql
@@ -22,12 +22,22 @@ private class DisposeCall extends MethodCall {
DisposeCall() { this.getTarget() instanceof DisposeMethod }
}
-private predicate localFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
- DataFlow::localFlowStep(nodeFrom, nodeTo) and
- not exists(AssignableDefinition def, UsingStmt us |
- nodeTo.asExpr() = def.getAReachableRead() and
+pragma[nomagic]
+private predicate isDisposedAccess(AssignableRead ar) {
+ exists(AssignableDefinition def, UsingStmt us |
+ ar = def.getAFirstRead() and
def.getTargetAccess() = us.getAVariableDeclExpr().getAccess()
)
+ or
+ exists(AssignableRead mid |
+ isDisposedAccess(mid) and
+ ar = mid.getANextRead()
+ )
+}
+
+private predicate localFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
+ DataFlow::localFlowStep(nodeFrom, nodeTo) and
+ not isDisposedAccess(nodeTo.asExpr())
}
private predicate reachesDisposeCall(DisposeCall disposeCall, DataFlow::Node node) {
diff --git a/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql b/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql
index deb9887b85a..c3b5068bb09 100644
--- a/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql
+++ b/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql
@@ -106,4 +106,4 @@ predicate mayNotBeDisposed(LocalScopeDisposableCreation disposable) {
from LocalScopeDisposableCreation disposable
where mayNotBeDisposed(disposable)
-select disposable, "Disposable '" + disposable.getType() + "' is created here but is not disposed."
+select disposable, "Disposable '" + disposable.getType() + "' is created but not disposed."
diff --git a/csharp/ql/src/Bad Practices/Implementation Hiding/AbstractToConcreteCollection.qhelp b/csharp/ql/src/Bad Practices/Implementation Hiding/AbstractToConcreteCollection.qhelp
index bac228017c8..2d0c1849914 100644
--- a/csharp/ql/src/Bad Practices/Implementation Hiding/AbstractToConcreteCollection.qhelp
+++ b/csharp/ql/src/Bad Practices/Implementation Hiding/AbstractToConcreteCollection.qhelp
@@ -18,7 +18,7 @@ more difficult to change which implementation you are using at a later date.
- C# Corner, C# Interface Based Development.
+ C# Corner, C# Interface Based Development.
diff --git a/csharp/ql/src/Bad Practices/Magic Constants/MagicConstantsNumbers.cs b/csharp/ql/src/Bad Practices/Magic Constants/MagicConstantsNumbers.cs
index 9e4673c9e0a..33eb8363b87 100644
--- a/csharp/ql/src/Bad Practices/Magic Constants/MagicConstantsNumbers.cs
+++ b/csharp/ql/src/Bad Practices/Magic Constants/MagicConstantsNumbers.cs
@@ -5,7 +5,7 @@ class Circle
{
return Math.Pow(radius, 2) * 3.14;
}
- public double circumfrence()
+ public double circumference()
{
return radius * 2 * 3.14;
}
diff --git a/csharp/ql/src/Bad Practices/Magic Constants/MagicNumbersUseConstant.cs b/csharp/ql/src/Bad Practices/Magic Constants/MagicNumbersUseConstant.cs
index 1d2b9dc7f2e..218d0a1ba11 100644
--- a/csharp/ql/src/Bad Practices/Magic Constants/MagicNumbersUseConstant.cs
+++ b/csharp/ql/src/Bad Practices/Magic Constants/MagicNumbersUseConstant.cs
@@ -6,7 +6,7 @@ class Circle
{
return Math.Pow(radius, 2) * 3.14; // BAD: use the "Pi" constant
}
- public double circumfrence()
+ public double circumference()
{
return radius * 2 * 3.14; // BAD: use the "Pi" constant
}
diff --git a/csharp/ql/src/CHANGELOG.md b/csharp/ql/src/CHANGELOG.md
index bf47d9f7f70..8bd7652a52c 100644
--- a/csharp/ql/src/CHANGELOG.md
+++ b/csharp/ql/src/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.4.1
+
+### Minor Analysis Improvements
+
+* The alert message of many queries have been changed to better follow the style guide and make the message consistent with other languages.
+
## 0.4.0
### Minor Analysis Improvements
diff --git a/csharp/ql/src/CSI/NullAlways.ql b/csharp/ql/src/CSI/NullAlways.ql
index 1c6ecf8997c..e52abdc3cd5 100644
--- a/csharp/ql/src/CSI/NullAlways.ql
+++ b/csharp/ql/src/CSI/NullAlways.ql
@@ -16,4 +16,4 @@ import semmle.code.csharp.dataflow.Nullness
from Dereference d, Ssa::SourceVariable v
where d.isFirstAlwaysNull(v)
-select d, "Variable $@ is always null here.", v, v.toString()
+select d, "Variable $@ is always null at this dereference.", v, v.toString()
diff --git a/csharp/ql/src/CSI/NullMaybe.ql b/csharp/ql/src/CSI/NullMaybe.ql
index eb20439a821..bb886f19929 100644
--- a/csharp/ql/src/CSI/NullMaybe.ql
+++ b/csharp/ql/src/CSI/NullMaybe.ql
@@ -19,4 +19,5 @@ import PathGraph
from
Dereference d, PathNode source, PathNode sink, Ssa::SourceVariable v, string msg, Element reason
where d.isFirstMaybeNull(v.getAnSsaDefinition(), source, sink, msg, reason)
-select d, source, sink, "Variable $@ may be null here " + msg + ".", v, v.toString(), reason, "this"
+select d, source, sink, "Variable $@ may be null at this access " + msg + ".", v, v.toString(),
+ reason, "this"
diff --git a/csharp/ql/src/Concurrency/SynchSetUnsynchGet.ql b/csharp/ql/src/Concurrency/SynchSetUnsynchGet.ql
index f2f216d2f88..9c8bb72708c 100644
--- a/csharp/ql/src/Concurrency/SynchSetUnsynchGet.ql
+++ b/csharp/ql/src/Concurrency/SynchSetUnsynchGet.ql
@@ -28,4 +28,4 @@ where
readaccess.getEnclosingCallable() = getter and
not exists(LockStmt readlock | readlock.getAChildStmt+().getAChildExpr+() = readaccess)
)
-select p, "Field '$@' is guarded by a lock in the setter but not in the getter.", f, f.getName()
+select p, "Field $@ is guarded by a lock in the setter but not in the getter.", f, f.getName()
diff --git a/csharp/ql/src/Dead Code/NonAssignedFields.ql b/csharp/ql/src/Dead Code/NonAssignedFields.ql
index 3c76ba0e58f..83aa889b77c 100644
--- a/csharp/ql/src/Dead Code/NonAssignedFields.ql
+++ b/csharp/ql/src/Dead Code/NonAssignedFields.ql
@@ -111,6 +111,5 @@ where
fa.getTarget() = g and
g.getUnboundDeclaration() = f
)
-select f,
- "The field '" + f.getName() + "' is never explicitly assigned a value, yet it is read $@.", fa,
- "here"
+select f, "The field '" + f.getName() + "' is never explicitly assigned a value, yet $@.", fa,
+ "the field is read"
diff --git a/csharp/ql/src/Dead Code/UnusedField.ql b/csharp/ql/src/Dead Code/UnusedField.ql
index 435ec6a370c..12a68f31324 100644
--- a/csharp/ql/src/Dead Code/UnusedField.ql
+++ b/csharp/ql/src/Dead Code/UnusedField.ql
@@ -19,4 +19,4 @@ where
f.fromSource() and
isDeadField(f) and
not f.getDeclaringType().isPartial()
-select f, "Unused field (or field used from dead method only)"
+select f, "Unused field (or field used from dead method only)."
diff --git a/csharp/ql/src/Dead Code/UnusedMethod.ql b/csharp/ql/src/Dead Code/UnusedMethod.ql
index 628803281f4..b2f69bd6651 100644
--- a/csharp/ql/src/Dead Code/UnusedMethod.ql
+++ b/csharp/ql/src/Dead Code/UnusedMethod.ql
@@ -20,4 +20,4 @@ where
m.fromSource() and
isDeadMethod(m) and
not m.getDeclaringType().isPartial()
-select m, "Unused method (or method called from dead method only)"
+select m, "Unused method (or method called from dead method only)."
diff --git a/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql b/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql
index cb86e293efc..cd387c11b4d 100644
--- a/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql
+++ b/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql
@@ -4,6 +4,7 @@
* without encountering an extraction or compiler error in the file.
* @kind diagnostic
* @id cs/diagnostics/successfully-extracted-files
+ * @tags successfully-extracted-files
*/
import csharp
diff --git a/csharp/ql/src/Language Abuse/ForeachCapture.ql b/csharp/ql/src/Language Abuse/ForeachCapture.ql
index b3597418390..babd79bb407 100644
--- a/csharp/ql/src/Language Abuse/ForeachCapture.ql
+++ b/csharp/ql/src/Language Abuse/ForeachCapture.ql
@@ -111,5 +111,5 @@ predicate declaredInsideLoop(ForeachStmt loop, LocalVariable v) {
from LambdaDataFlowConfiguration c, AnonymousFunctionExpr lambda, Variable loopVar, Element storage
where c.capturesLoopVarAndIsStoredIn(lambda, loopVar, storage)
-select lambda, "Function which may be stored in $@ captures variable $@", storage,
+select lambda, "Function which may be stored in $@ captures variable $@.", storage,
storage.toString(), loopVar, loopVar.getName()
diff --git a/csharp/ql/src/Language Abuse/UselessIsBeforeAs.ql b/csharp/ql/src/Language Abuse/UselessIsBeforeAs.ql
index e784bb4258d..6a82c40d840 100644
--- a/csharp/ql/src/Language Abuse/UselessIsBeforeAs.ql
+++ b/csharp/ql/src/Language Abuse/UselessIsBeforeAs.ql
@@ -35,5 +35,5 @@ where
uselessIsBeforeAs(ae, ie) and
not exists(MethodCall mc | ae = mc.getAnArgument().getAChildExpr*())
select ae,
- "This 'as' expression performs a type test - it should be directly compared against null, rendering the 'is' $@ potentially redundant.",
- ie, "here"
+ "This 'as' expression performs a type test - it should be directly compared against null, rendering the $@ potentially redundant.",
+ ie, "is"
diff --git a/csharp/ql/src/Likely Bugs/ConstantComparison.qhelp b/csharp/ql/src/Likely Bugs/ConstantComparison.qhelp
index e1d6f9d5f9f..5e52142c84e 100644
--- a/csharp/ql/src/Likely Bugs/ConstantComparison.qhelp
+++ b/csharp/ql/src/Likely Bugs/ConstantComparison.qhelp
@@ -5,7 +5,7 @@
Comparisons which always yield the same result are unnecessary and may indicate a bug in the
- logic. This can can happen when the data type of one of the operands has a limited range of values.
+ logic. This can happen when the data type of one of the operands has a limited range of values.
For example unsigned integers are always greater than or equal to zero, and byte
values are always less than 256.
diff --git a/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.qhelp b/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.qhelp
index a2000deb2d5..c77c656a655 100644
--- a/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.qhelp
+++ b/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.qhelp
@@ -9,7 +9,7 @@
- Use speific era when creating DateTime and DateTimeOffset structs from previously stored date in Japanese calendar
+ Use specific era when creating DateTime and DateTimeOffset structs from previously stored date in Japanese calendar
Don't store dates in Japanese format
Don't use hard-coded era start date for date calculations converting dates from Japanese date format
Use JapaneseCalendar class for date formatting only
diff --git a/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.qhelp b/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.qhelp
index 1ccdceb7412..325a4531afe 100644
--- a/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.qhelp
+++ b/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.qhelp
@@ -6,7 +6,7 @@
-Create new instances of the object that implements or has a field of type System.Security.Cryptography.ICryptoTransform to avoid sharing it accross multiple threads.
+Create new instances of the object that implements or has a field of type System.Security.Cryptography.ICryptoTransform to avoid sharing it across multiple threads.
diff --git a/csharp/ql/src/Linq/BadMultipleIteration.ql b/csharp/ql/src/Linq/BadMultipleIteration.ql
index 3c8b8c1418b..e07de273e63 100644
--- a/csharp/ql/src/Linq/BadMultipleIteration.ql
+++ b/csharp/ql/src/Linq/BadMultipleIteration.ql
@@ -59,6 +59,5 @@ where
va = seq.getAnAccess() and
potentiallyConsumingAccess(va) and
count(VariableAccess x | x = seq.getAnAccess() and potentiallyConsumingAccess(x)) > 1
-select seq,
- "This enumerable sequence may not be repeatable, but is potentially consumed multiple times $@.",
- va, "here"
+select seq, "This enumerable sequence may not be repeatable, but $@.", va,
+ "it is potentially consumed multiple times"
diff --git a/csharp/ql/src/Linq/MissedCastOpportunity.ql b/csharp/ql/src/Linq/MissedCastOpportunity.ql
index 2c61d5cb9f6..24d1c87bd2a 100644
--- a/csharp/ql/src/Linq/MissedCastOpportunity.ql
+++ b/csharp/ql/src/Linq/MissedCastOpportunity.ql
@@ -16,5 +16,5 @@ import Linq.Helpers
from ForeachStmt fes, LocalVariableDeclStmt s
where missedCastOpportunity(fes, s)
select fes,
- "This foreach loop immediately casts its iteration variable to another type $@ - consider casting the sequence explicitly using '.Cast(...)'.",
- s, "here"
+ "This foreach loop immediately $@ - consider casting the sequence explicitly using '.Cast(...)'.",
+ s, "casts its iteration variable to another type"
diff --git a/csharp/ql/src/Linq/MissedOfTypeOpportunity.ql b/csharp/ql/src/Linq/MissedOfTypeOpportunity.ql
index 226cacd98fb..3a984d0cc3e 100644
--- a/csharp/ql/src/Linq/MissedOfTypeOpportunity.ql
+++ b/csharp/ql/src/Linq/MissedOfTypeOpportunity.ql
@@ -16,5 +16,5 @@ import Linq.Helpers
from ForeachStmt fes, LocalVariableDeclStmt s
where missedOfTypeOpportunity(fes, s)
select fes,
- "This foreach loop immediately uses 'as' to coerce its iteration variable to another type $@ - consider using '.OfType(...)' instead.",
- s, "here"
+ "This foreach loop immediately uses 'as' to $@ - consider using '.OfType(...)' instead.", s,
+ "coerce its iteration variable to another type"
diff --git a/csharp/ql/src/Linq/MissedSelectOpportunity.ql b/csharp/ql/src/Linq/MissedSelectOpportunity.ql
index a7c3385c2d0..1714aed81da 100644
--- a/csharp/ql/src/Linq/MissedSelectOpportunity.ql
+++ b/csharp/ql/src/Linq/MissedSelectOpportunity.ql
@@ -25,5 +25,5 @@ where
missedSelectOpportunity(fes, s) and
not oversized(s)
select fes,
- "This foreach loop immediately maps its iteration variable to another variable $@ - consider mapping the sequence explicitly using '.Select(...)'.",
- s, "here"
+ "This foreach loop immediately $@ - consider mapping the sequence explicitly using '.Select(...)'.",
+ s, "maps its iteration variable to another variable"
diff --git a/csharp/ql/src/Linq/MissedWhereOpportunity.ql b/csharp/ql/src/Linq/MissedWhereOpportunity.ql
index 9a7f0407ccb..4c93b7ab6bf 100644
--- a/csharp/ql/src/Linq/MissedWhereOpportunity.ql
+++ b/csharp/ql/src/Linq/MissedWhereOpportunity.ql
@@ -17,5 +17,5 @@ where
missedWhereOpportunity(fes, is) and
not missedAllOpportunity(fes)
select fes,
- "This foreach loop implicitly filters its target sequence $@ - consider filtering the sequence explicitly using '.Where(...)'.",
- is.getCondition(), "here"
+ "This foreach loop $@ - consider filtering the sequence explicitly using '.Where(...)'.",
+ is.getCondition(), "implicitly filters its target sequence"
diff --git a/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql b/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
index 3e395e747b5..545484e6294 100644
--- a/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
+++ b/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
@@ -20,5 +20,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in a path.", source.getNode(),
- "User-provided value"
+select sink.getNode(), source, sink, "This path depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql b/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
index 983189a6c55..20a7be1c5b0 100644
--- a/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
@@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in a command.", source.getNode(),
- "User-provided value"
+select sink.getNode(), source, sink, "This command line depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-078/StoredCommandInjection.ql b/csharp/ql/src/Security Features/CWE-078/StoredCommandInjection.ql
index 656b8b51786..8fa673f50f3 100644
--- a/csharp/ql/src/Security Features/CWE-078/StoredCommandInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-078/StoredCommandInjection.ql
@@ -24,5 +24,5 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in a command.", source.getNode(),
- "Stored user-provided value"
+select sink.getNode(), source, sink, "This command line depends on a $@.", source.getNode(),
+ "stored (potentially user-provided) value"
diff --git a/csharp/ql/src/Security Features/CWE-079/StoredXSS.ql b/csharp/ql/src/Security Features/CWE-079/StoredXSS.ql
index 2286b59b0fe..f2dc334539c 100644
--- a/csharp/ql/src/Security Features/CWE-079/StoredXSS.ql
+++ b/csharp/ql/src/Security Features/CWE-079/StoredXSS.ql
@@ -29,8 +29,8 @@ from
where
c.hasFlowPath(source, sink) and
if exists(sink.getNode().(Sink).explanation())
- then explanation = ": " + sink.getNode().(Sink).explanation() + "."
- else explanation = "."
+ then explanation = " (" + sink.getNode().(Sink).explanation() + ")"
+ else explanation = ""
select sink.getNode(), source, sink,
- "$@ flows to here and is written to HTML or JavaScript" + explanation, source.getNode(),
- "Stored user-provided value"
+ "This HTML or JavaScript write" + explanation + " depends on a $@.", source.getNode(),
+ "stored (potentially user-provided) value"
diff --git a/csharp/ql/src/Security Features/CWE-089/SecondOrderSqlInjection.ql b/csharp/ql/src/Security Features/CWE-089/SecondOrderSqlInjection.ql
index 77c9e1dd34b..3d363d87310 100644
--- a/csharp/ql/src/Security Features/CWE-089/SecondOrderSqlInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-089/SecondOrderSqlInjection.ql
@@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends SqlInjection::TaintTrackingConfig
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in an SQL query.",
- source.getNode(), "Stored user-provided value"
+select sink.getNode(), source, sink, "This SQL query depends on a $@.", source.getNode(),
+ "stored user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql b/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
index 09b1e637090..e4298741ca8 100644
--- a/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
@@ -25,5 +25,5 @@ string getSourceType(DataFlow::Node node) {
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "Query might include code from $@.", source,
+select sink.getNode(), source, sink, "This query depends on $@.", source,
("this " + getSourceType(source.getNode()))
diff --git a/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql b/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
index 3f4eae7a10c..f4413eeb17a 100644
--- a/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
@@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in an LDAP query.",
- source.getNode(), "User-provided value"
+select sink.getNode(), source, sink, "This LDAP query depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-090/StoredLDAPInjection.ql b/csharp/ql/src/Security Features/CWE-090/StoredLDAPInjection.ql
index 2f6b20bad4e..26a0711037d 100644
--- a/csharp/ql/src/Security Features/CWE-090/StoredLDAPInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-090/StoredLDAPInjection.ql
@@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in an LDAP query.",
- source.getNode(), "Stored user-provided value"
+select sink.getNode(), source, sink, "This LDAP query depends on a $@.", source.getNode(),
+ "stored (potentially user-provided) value"
diff --git a/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql b/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
index 02aa158a120..038dc267d14 100644
--- a/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
@@ -48,4 +48,5 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink, source, sink, "$@ flows to here and is inserted as XML.", source, "User-provided value"
+select sink.getNode(), source, sink, "This XML element depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql b/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
index deac49329b7..17e15fee924 100644
--- a/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
@@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is compiled as code.", source.getNode(),
- "User-provided value"
+select sink.getNode(), source, sink, "This code compilation depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql b/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql
index 9bb38adc895..23f60cb2368 100644
--- a/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql
@@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in a resource descriptor.",
- source.getNode(), "User-provided value"
+select sink.getNode(), source, sink, "This resource descriptor depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-112/MissingXMLValidation.ql b/csharp/ql/src/Security Features/CWE-112/MissingXMLValidation.ql
index 3367771e0bf..7b6d069b211 100644
--- a/csharp/ql/src/Security Features/CWE-112/MissingXMLValidation.ql
+++ b/csharp/ql/src/Security Features/CWE-112/MissingXMLValidation.ql
@@ -18,5 +18,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
- "$@ flows to here and is processed as XML without validation because " +
- sink.getNode().(Sink).getReason(), source.getNode(), "User-provided value"
+ "This XML processing depends on a $@ without validation because " +
+ sink.getNode().(Sink).getReason(), source.getNode(), "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql b/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql
index 9c3b9b21bac..3ca894db15a 100644
--- a/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql
@@ -49,5 +49,4 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
from TaintTrackingConfiguration c, DataFlow::Node source, DataFlow::Node sink
where c.hasFlow(source, sink)
-select sink, "$@ flows to here and is used as the path to dynamically load an assembly.", source,
- "User-provided value"
+select sink, "This assembly path depends on a $@.", source, "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-117/LogForging.ql b/csharp/ql/src/Security Features/CWE-117/LogForging.ql
index 039af51123e..adbee47ed59 100644
--- a/csharp/ql/src/Security Features/CWE-117/LogForging.ql
+++ b/csharp/ql/src/Security Features/CWE-117/LogForging.ql
@@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to log entry.", source.getNode(),
- "User-provided value"
+select sink.getNode(), source, sink, "This log entry depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql b/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql
index f2b0918e1e5..35529f4e234 100644
--- a/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql
+++ b/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql
@@ -31,7 +31,13 @@ class FormatStringConfiguration extends TaintTracking::Configuration {
}
}
+string getSourceType(DataFlow::Node node) {
+ result = node.(RemoteFlowSource).getSourceType()
+ or
+ result = node.(LocalFlowSource).getSourceType()
+}
+
from FormatStringConfiguration config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used as a format string.",
- source.getNode(), source.getNode().toString()
+select sink.getNode(), source, sink, "This format string depends on $@.", source.getNode(),
+ ("this" + getSourceType(source.getNode()))
diff --git a/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql b/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql
index ed3e5da0b1f..3bcb16b749d 100644
--- a/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql
+++ b/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql
@@ -47,6 +47,5 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
from TaintTrackingConfiguration configuration, DataFlow::PathNode source, DataFlow::PathNode sink
where configuration.hasFlowPath(source, sink)
-select sink.getNode(), source, sink,
- "Sensitive information from $@ flows to here, and is transmitted to the user.", source.getNode(),
- source.toString()
+select sink.getNode(), source, sink, "This data transmitted to the user depends on $@.",
+ source.getNode(), "sensitive information"
diff --git a/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql b/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql
index 7f9c87de5fc..0f374fb6abe 100644
--- a/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql
+++ b/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql
@@ -64,6 +64,5 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink,
- "Exception information from $@ flows to here, and is exposed to the user.", source.getNode(),
- source.toString()
+select sink.getNode(), source, sink, "This information exposed to the user depends on $@.",
+ source.getNode(), "exception information"
diff --git a/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql b/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql
index f7eacf40fc8..8ecdb0039fc 100644
--- a/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql
+++ b/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql
@@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "Sensitive data returned by $@ is stored here.",
+select sink.getNode(), source, sink, "This stores sensitive data returned by $@ as clear text.",
source.getNode(), source.toString()
diff --git a/csharp/ql/src/Security Features/CWE-321/HardcodedEncryptionKey.ql b/csharp/ql/src/Security Features/CWE-321/HardcodedEncryptionKey.ql
index d2e95de43bf..8f30847cde0 100644
--- a/csharp/ql/src/Security Features/CWE-321/HardcodedEncryptionKey.ql
+++ b/csharp/ql/src/Security Features/CWE-321/HardcodedEncryptionKey.ql
@@ -38,5 +38,5 @@ class StringLiteralSource extends KeySource {
from SymmetricKeyTaintTrackingConfiguration keyFlow, KeySource src, SymmetricEncryptionKeySink sink
where keyFlow.hasFlow(src, sink)
-select sink, "Hard-coded symmetric $@ is used in symmetric algorithm in " + sink.getDescription(),
- src, "key"
+select sink, "This hard-coded $@ is used in symmetric algorithm in " + sink.getDescription(), src,
+ "symmetric key"
diff --git a/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql b/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql
index a4f4d63d6ee..4f7e04f1175 100644
--- a/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql
+++ b/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql
@@ -41,4 +41,4 @@ class AddCertToRootStoreConfig extends DataFlow::Configuration {
from DataFlow::PathNode oc, DataFlow::PathNode mc, AddCertToRootStoreConfig config
where config.hasFlowPath(oc, mc)
-select mc.getNode(), oc, mc, "Certificate added to the root certificate store."
+select mc.getNode(), oc, mc, "This certificate is added to the root certificate store."
diff --git a/csharp/ql/src/Security Features/CWE-327/InsecureSQLConnection.ql b/csharp/ql/src/Security Features/CWE-327/InsecureSQLConnection.ql
index 25c8ea6ef89..8f7a49db36d 100644
--- a/csharp/ql/src/Security Features/CWE-327/InsecureSQLConnection.ql
+++ b/csharp/ql/src/Security Features/CWE-327/InsecureSQLConnection.ql
@@ -41,5 +41,6 @@ class TaintTrackingConfiguration extends DataFlow::Configuration {
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and does not specify `Encrypt=True`.",
- source.getNode(), "Connection string"
+select sink.getNode(), source, sink,
+ "$@ flows to this SQL connection and does not specify `Encrypt=True`.", source.getNode(),
+ "Connection string"
diff --git a/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql b/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql
index a58e94f4cf3..ffdb7220f01 100644
--- a/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql
+++ b/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql
@@ -69,5 +69,5 @@ where
loginMethod(loginMethod, fromLoginFlow) and
sessionUse(sessionUse.getElement()) and
controlStep+(loginCall.getASuccessorByType(fromLoginFlow), sessionUse)
-select sessionUse, "This session has not been invalidated following the call to '$@'.", loginCall,
+select sessionUse, "This session has not been invalidated following the call to $@.", loginCall,
loginMethod.getName()
diff --git a/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql b/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql
index 568da9188d5..9bd90a5b212 100644
--- a/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql
+++ b/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql
@@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
- "$@ flows to here and is loaded insecurely as XML (" + sink.getNode().(Sink).getReason() + ").",
- source.getNode(), "User-provided value"
+ "This insecure XML processing depends on a $@ (" + sink.getNode().(Sink).getReason() + ").",
+ source.getNode(), "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-643/StoredXPathInjection.ql b/csharp/ql/src/Security Features/CWE-643/StoredXPathInjection.ql
index 651ffa15f4f..46fd76a2453 100644
--- a/csharp/ql/src/Security Features/CWE-643/StoredXPathInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-643/StoredXPathInjection.ql
@@ -22,5 +22,5 @@ class StoredTaintTrackingConfiguration extends XPathInjection::TaintTrackingConf
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in an XPath expression.",
- source.getNode(), "Stored user-provided value"
+select sink.getNode(), source, sink, "This XPath expression depends on a $@.", source.getNode(),
+ "stored (potentially user-provided) value"
diff --git a/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql b/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
index 8bcf350f594..c05e34d09db 100644
--- a/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
+++ b/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
@@ -17,5 +17,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in an XPath expression.",
- source.getNode(), "User-provided value"
+select sink.getNode(), source, sink, "This XPath expression depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-730/ReDoS.ql b/csharp/ql/src/Security Features/CWE-730/ReDoS.ql
index df151dddf5b..9d74f5b6e6e 100644
--- a/csharp/ql/src/Security Features/CWE-730/ReDoS.ql
+++ b/csharp/ql/src/Security Features/CWE-730/ReDoS.ql
@@ -29,5 +29,5 @@ where
sink.getNode() instanceof ExponentialRegexSink
)
select sink.getNode(), source, sink,
- "$@ flows to regular expression operation with dangerous regex.", source.getNode(),
- "User-provided value"
+ "This regex operation with dangerous complexity depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql b/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql
index 3bdb1f6c7bd..5fc59c13c57 100644
--- a/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql
+++ b/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql
@@ -19,6 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from Configuration config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
-select sink.getNode().(Sink).getSensitiveMethodCall(), source, sink,
- "Sensitive method may not be executed depending on $@, which flows from $@.", sink.getNode(),
- "this condition", source.getNode(), "user input"
+select sink.getNode(), source, sink, "This condition guards a sensitive $@, but a $@ controls it.",
+ sink.getNode().(Sink).getSensitiveMethodCall(), "action", source.getNode(), "user-provided value"
diff --git a/csharp/ql/src/Security Features/Encryption using ECB.qhelp b/csharp/ql/src/Security Features/Encryption using ECB.qhelp
index 0315813d7bc..db66106f834 100644
--- a/csharp/ql/src/Security Features/Encryption using ECB.qhelp
+++ b/csharp/ql/src/Security Features/Encryption using ECB.qhelp
@@ -4,7 +4,7 @@
ECB should not be used as a mode for encryption. It has dangerous weaknesses. Data is encrypted the same way every time
-meaning the same plaintext input will always produce the same cyphertext. This makes encrypted messages vulnerable
+meaning the same plaintext input will always produce the same ciphertext. This makes encrypted messages vulnerable
to replay attacks.
diff --git a/csharp/ql/src/Security Features/InsecureRandomness.ql b/csharp/ql/src/Security Features/InsecureRandomness.ql
index 08b46a41439..6262eac9df2 100644
--- a/csharp/ql/src/Security Features/InsecureRandomness.ql
+++ b/csharp/ql/src/Security Features/InsecureRandomness.ql
@@ -117,5 +117,5 @@ from
DataFlow::PathNode sink
where randomTracking.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
- "Cryptographically insecure random number is generated at $@ and used here in a security context.",
+ "This uses a cryptographically insecure random number generated at $@ in a security context.",
source.getNode(), source.getNode().toString()
diff --git a/csharp/ql/src/Telemetry/ExternalApi.qll b/csharp/ql/src/Telemetry/ExternalApi.qll
index 685eda64e50..d4cc0ae43cc 100644
--- a/csharp/ql/src/Telemetry/ExternalApi.qll
+++ b/csharp/ql/src/Telemetry/ExternalApi.qll
@@ -17,8 +17,10 @@ private import semmle.code.csharp.security.dataflow.flowsources.Remote
class TestLibrary extends RefType {
TestLibrary() {
this.getNamespace()
- .getName()
- .matches(["NUnit.Framework%", "Xunit%", "Microsoft.VisualStudio.TestTools.UnitTesting%"])
+ .getQualifiedName()
+ .matches([
+ "NUnit.Framework%", "Xunit%", "Microsoft.VisualStudio.TestTools.UnitTesting%", "Moq%"
+ ])
}
}
@@ -114,29 +116,39 @@ class ExternalApi extends DotNet::Callable {
int resultLimit() { result = 1000 }
/**
- * Holds if the relevant usage count of `api` is `usages`.
+ * Holds if it is relevant to count usages of `api`.
*/
-signature predicate relevantUsagesSig(ExternalApi api, int usages);
+signature predicate relevantApi(ExternalApi api);
/**
* Given a predicate to count relevant API usages, this module provides a predicate
* for restricting the number or returned results based on a certain limit.
*/
-module Results {
- private int getOrder(ExternalApi api) {
- api =
- rank[result](ExternalApi a, int usages |
- getRelevantUsages(a, usages)
+module Results {
+ private int getUsages(string apiInfo) {
+ result =
+ strictcount(DispatchCall c, ExternalApi api |
+ c = api.getACall() and
+ apiInfo = api.getInfo() and
+ getRelevantUsages(api)
+ )
+ }
+
+ private int getOrder(string apiInfo) {
+ apiInfo =
+ rank[result](string info, int usages |
+ usages = getUsages(info)
|
- a order by usages desc, a.getInfo()
+ info order by usages desc, info
)
}
/**
- * Holds if `api` is being used `usages` times and if it is
- * in the top results (guarded by resultLimit).
+ * Holds if there exists an API with `apiInfo` that is being used `usages` times
+ * and if it is in the top results (guarded by resultLimit).
*/
- predicate restrict(ExternalApi api, int usages) {
- getRelevantUsages(api, usages) and getOrder(api) <= resultLimit()
+ predicate restrict(string apiInfo, int usages) {
+ usages = getUsages(apiInfo) and
+ getOrder(apiInfo) <= resultLimit()
}
}
diff --git a/csharp/ql/src/Telemetry/SupportedExternalSinks.ql b/csharp/ql/src/Telemetry/SupportedExternalSinks.ql
index 74d36bc4cec..4eb42c4628f 100644
--- a/csharp/ql/src/Telemetry/SupportedExternalSinks.ql
+++ b/csharp/ql/src/Telemetry/SupportedExternalSinks.ql
@@ -10,12 +10,11 @@ private import csharp
private import semmle.code.csharp.dispatch.Dispatch
private import ExternalApi
-private predicate getRelevantUsages(ExternalApi api, int usages) {
+private predicate relevant(ExternalApi api) {
not api.isUninteresting() and
- api.isSink() and
- usages = strictcount(DispatchCall c | c = api.getACall())
+ api.isSink()
}
-from ExternalApi api, int usages
-where Results::restrict(api, usages)
-select api.getInfo() as info, usages order by usages desc
+from string info, int usages
+where Results::restrict(info, usages)
+select info, usages order by usages desc
diff --git a/csharp/ql/src/Telemetry/SupportedExternalSources.ql b/csharp/ql/src/Telemetry/SupportedExternalSources.ql
index 9e57adb9b22..0d0b38a4754 100644
--- a/csharp/ql/src/Telemetry/SupportedExternalSources.ql
+++ b/csharp/ql/src/Telemetry/SupportedExternalSources.ql
@@ -10,12 +10,11 @@ private import csharp
private import semmle.code.csharp.dispatch.Dispatch
private import ExternalApi
-private predicate getRelevantUsages(ExternalApi api, int usages) {
+private predicate relevant(ExternalApi api) {
not api.isUninteresting() and
- api.isSource() and
- usages = strictcount(DispatchCall c | c = api.getACall())
+ api.isSource()
}
-from ExternalApi api, int usages
-where Results::restrict(api, usages)
-select api.getInfo() as info, usages order by usages desc
+from string info, int usages
+where Results::restrict(info, usages)
+select info, usages order by usages desc
diff --git a/csharp/ql/src/Telemetry/SupportedExternalTaint.ql b/csharp/ql/src/Telemetry/SupportedExternalTaint.ql
index 5e8a816b3f6..3eccf73b58b 100644
--- a/csharp/ql/src/Telemetry/SupportedExternalTaint.ql
+++ b/csharp/ql/src/Telemetry/SupportedExternalTaint.ql
@@ -10,12 +10,11 @@ private import csharp
private import semmle.code.csharp.dispatch.Dispatch
private import ExternalApi
-private predicate getRelevantUsages(ExternalApi api, int usages) {
+private predicate relevant(ExternalApi api) {
not api.isUninteresting() and
- api.hasSummary() and
- usages = strictcount(DispatchCall c | c = api.getACall())
+ api.hasSummary()
}
-from ExternalApi api, int usages
-where Results::restrict(api, usages)
-select api.getInfo() as info, usages order by usages desc
+from string info, int usages
+where Results::restrict(info, usages)
+select info, usages order by usages desc
diff --git a/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql b/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql
index 69b8793abc1..4823a4e2dbc 100644
--- a/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql
+++ b/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql
@@ -12,13 +12,12 @@ private import semmle.code.csharp.dataflow.internal.FlowSummaryImpl as FlowSumma
private import semmle.code.csharp.dataflow.internal.NegativeSummary
private import ExternalApi
-private predicate getRelevantUsages(ExternalApi api, int usages) {
+private predicate relevant(ExternalApi api) {
not api.isUninteresting() and
not api.isSupported() and
- not api instanceof FlowSummaryImpl::Public::NegativeSummarizedCallable and
- usages = strictcount(DispatchCall c | c = api.getACall())
+ not api instanceof FlowSummaryImpl::Public::NegativeSummarizedCallable
}
-from ExternalApi api, int usages
-where Results::restrict(api, usages)
-select api.getInfo() as info, usages order by usages desc
+from string info, int usages
+where Results::restrict(info, usages)
+select info, usages order by usages desc
diff --git a/csharp/ql/src/Useless code/DefaultToStringQuery.qll b/csharp/ql/src/Useless code/DefaultToStringQuery.qll
index 9ba8be009da..9185756b0a9 100644
--- a/csharp/ql/src/Useless code/DefaultToStringQuery.qll
+++ b/csharp/ql/src/Useless code/DefaultToStringQuery.qll
@@ -6,6 +6,7 @@ import semmle.code.csharp.frameworks.System
* Holds if expression `e`, of type `t`, invokes `ToString()` either explicitly
* or implicitly.
*/
+pragma[nomagic]
predicate invokesToString(Expr e, ValueOrRefType t) {
// Explicit invocation
exists(MethodCall mc | mc.getQualifier() = e |
@@ -20,20 +21,24 @@ predicate invokesToString(Expr e, ValueOrRefType t) {
// Implicit invocation via forwarder method
t = e.stripCasts().getType() and
not t instanceof StringType and
- exists(Parameter p |
- alwaysInvokesToStringOnParameter(p) and
+ exists(AssignableDefinitions::ImplicitParameterDefinition def, Parameter p |
+ def.getParameter() = p and
+ alwaysInvokesToString(def.getAFirstRead()) and
e = p.getAnAssignedArgument()
)
}
-pragma[noinline]
-private predicate alwaysInvokesToStringOnParameter(Parameter p) {
- exists(AssignableDefinitions::ImplicitParameterDefinition def, ParameterRead pr |
- def.getParameter() = p and
- pr = def.getAReachableRead() and
- pr.getAControlFlowNode().postDominates(p.getCallable().getEntryPoint()) and
- invokesToString(pr, _)
- )
+pragma[nomagic]
+private predicate parameterReadPostDominatesEntry(ParameterRead pr) {
+ pr.getAControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint())
+}
+
+pragma[nomagic]
+private predicate alwaysInvokesToString(ParameterRead pr) {
+ parameterReadPostDominatesEntry(pr) and
+ invokesToString(pr, _)
+ or
+ alwaysInvokesToString(pr.getANextRead())
}
/**
diff --git a/csharp/ql/src/change-notes/released/0.4.1.md b/csharp/ql/src/change-notes/released/0.4.1.md
new file mode 100644
index 00000000000..f5e1dbf00ed
--- /dev/null
+++ b/csharp/ql/src/change-notes/released/0.4.1.md
@@ -0,0 +1,5 @@
+## 0.4.1
+
+### Minor Analysis Improvements
+
+* The alert message of many queries have been changed to better follow the style guide and make the message consistent with other languages.
diff --git a/csharp/ql/src/codeql-pack.release.yml b/csharp/ql/src/codeql-pack.release.yml
index 458bfbeccff..89fa3a87180 100644
--- a/csharp/ql/src/codeql-pack.release.yml
+++ b/csharp/ql/src/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 0.4.0
+lastReleaseVersion: 0.4.1
diff --git a/csharp/ql/src/experimental/CWE-099/TaintedWebClient.ql b/csharp/ql/src/experimental/CWE-099/TaintedWebClient.ql
index 513c658cf92..8cee95a3d54 100644
--- a/csharp/ql/src/experimental/CWE-099/TaintedWebClient.ql
+++ b/csharp/ql/src/experimental/CWE-099/TaintedWebClient.ql
@@ -19,5 +19,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in a method of WebClient.",
- source.getNode(), "User-provided value"
+select sink.getNode(), source, sink, "A method of WebClient depepends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/experimental/CWE-918/RequestForgery.ql b/csharp/ql/src/experimental/CWE-918/RequestForgery.ql
index 27b86aa1386..53af17bb842 100644
--- a/csharp/ql/src/experimental/CWE-918/RequestForgery.ql
+++ b/csharp/ql/src/experimental/CWE-918/RequestForgery.ql
@@ -15,5 +15,5 @@ import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
from RequestForgeryConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "$@ flows to here and is used in a server side web request.",
- source.getNode(), "User-provided value"
+select sink.getNode(), source, sink, "The URL of this request depends on a $@.", source.getNode(),
+ "user-provided value"
diff --git a/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.cs b/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.cs
index bee97118ea8..0810516ee40 100644
--- a/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.cs
+++ b/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.cs
@@ -17,7 +17,7 @@ var client = new BlobClient(myConnectionString, new SpecializedBlobClientOptions
{
KeyEncryptionKey = myKey,
KeyResolver = myKeyResolver,
- KeyWrapAlgorihm = myKeyWrapAlgorithm
+ KeyWrapAlgorithm = myKeyWrapAlgorithm
}
});
@@ -28,7 +28,7 @@ var client = new BlobClient(myConnectionString, new SpecializedBlobClientOptions
{
KeyEncryptionKey = myKey,
KeyResolver = myKeyResolver,
- KeyWrapAlgorihm = myKeyWrapAlgorithm
+ KeyWrapAlgorithm = myKeyWrapAlgorithm
}
});
@@ -39,6 +39,6 @@ var client = new BlobClient(myConnectionString, new SpecializedBlobClientOptions
{
KeyEncryptionKey = myKey,
KeyResolver = myKeyResolver,
- KeyWrapAlgorihm = myKeyWrapAlgorithm
+ KeyWrapAlgorithm = myKeyWrapAlgorithm
}
});
\ No newline at end of file
diff --git a/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.ql b/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.ql
index 57561944718..753dfb82999 100644
--- a/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.ql
+++ b/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.ql
@@ -17,5 +17,6 @@ import JsonWebTokenHandlerLib
from TokenValidationParametersProperty p, CallableAlwaysReturnsTrueHigherPrecision e
where e = p.getAnAssignedValue()
-select e, "JsonWebTokenHandler security-sensitive property $@ is being delegated to $@.", p,
- p.getQualifiedName().toString(), e, "a callable that always returns \"true\""
+select e,
+ "JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns \"true\".",
+ p, p.getQualifiedName().toString()
diff --git a/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/security-validation-disabled.ql b/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/security-validation-disabled.ql
index cfc745e5314..9c2a5d3983f 100644
--- a/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/security-validation-disabled.ql
+++ b/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/security-validation-disabled.ql
@@ -1,6 +1,6 @@
/**
* @name Security sensitive JsonWebTokenHandler validations are disabled
- * @description Check if secruity sensitive token validations for `JsonWebTokenHandler` are being disabled.
+ * @description Check if security sensitive token validations for `JsonWebTokenHandler` are being disabled.
* @kind problem
* @tags security
* JsonWebTokenHandler
diff --git a/csharp/ql/src/experimental/Security Features/backdoor/PotentialTimeBomb.ql b/csharp/ql/src/experimental/Security Features/backdoor/PotentialTimeBomb.ql
index 4745daf6b8b..9de38f673ab 100644
--- a/csharp/ql/src/experimental/Security Features/backdoor/PotentialTimeBomb.ql
+++ b/csharp/ql/src/experimental/Security Features/backdoor/PotentialTimeBomb.ql
@@ -61,7 +61,7 @@ class DateTimeStruct extends Struct {
/**
* holds if the Callable is used for DateTime arithmetic operations
*/
- Callable getATimeSpanArtithmeticCallable() {
+ Callable getATimeSpanArithmeticCallable() {
(result = this.getAnOperator() or result = this.getAMethod()) and
result.getName() in [
"Add", "AddDays", "AddHours", "AddMilliseconds", "AddMinutes", "AddMonths", "AddSeconds",
@@ -96,7 +96,7 @@ private class FlowsFromGetLastWriteTimeConfigToTimeSpanArithmeticCallable extend
override predicate isSink(DataFlow::Node sink) {
exists(Call call, DateTimeStruct dateTime |
call.getAChild*() = sink.asExpr() and
- call = dateTime.getATimeSpanArtithmeticCallable().getACall()
+ call = dateTime.getATimeSpanArithmeticCallable().getACall()
)
}
}
@@ -111,7 +111,7 @@ private class FlowsFromTimeSpanArithmeticToTimeComparisonCallable extends TaintT
override predicate isSource(DataFlow::Node source) {
exists(DateTimeStruct dateTime, Call call | source.asExpr() = call |
- call = dateTime.getATimeSpanArtithmeticCallable().getACall()
+ call = dateTime.getATimeSpanArithmeticCallable().getACall()
)
}
@@ -157,7 +157,7 @@ predicate isPotentialTimeBomb(
|
pathSource.getNode() = exprNode(getLastWriteTimeMethodCall) and
config1.hasFlow(exprNode(getLastWriteTimeMethodCall), sink) and
- timeArithmeticCall = dateTime.getATimeSpanArtithmeticCallable().getACall() and
+ timeArithmeticCall = dateTime.getATimeSpanArithmeticCallable().getACall() and
timeArithmeticCall.getAChild*() = sink.asExpr() and
config2.hasFlow(exprNode(timeArithmeticCall), sink2) and
timeComparisonCall = dateTime.getAComparisonCallable().getACall() and
@@ -175,6 +175,6 @@ where
isPotentialTimeBomb(source, sink, getLastWriteTimeMethodCall, timeArithmeticCall,
timeComparisonCall, selStatement)
select selStatement, source, sink,
- "Possible TimeBomb logic triggered by $@ that takes into account $@ from the $@ as part of the potential trigger.",
- timeComparisonCall, timeComparisonCall.toString(), timeArithmeticCall, "an offset",
+ "Possible TimeBomb logic triggered by an $@ that takes into account $@ from the $@ as part of the potential trigger.",
+ timeComparisonCall, timeComparisonCall.toString(), timeArithmeticCall, "offset",
getLastWriteTimeMethodCall, "last modification time of a file"
diff --git a/csharp/ql/src/experimental/Security Features/backdoor/ProcessNameToHashTaintFlow.ql b/csharp/ql/src/experimental/Security Features/backdoor/ProcessNameToHashTaintFlow.ql
index 14d0cc02e44..5bb8a1dc6e9 100644
--- a/csharp/ql/src/experimental/Security Features/backdoor/ProcessNameToHashTaintFlow.ql
+++ b/csharp/ql/src/experimental/Security Features/backdoor/ProcessNameToHashTaintFlow.ql
@@ -50,5 +50,5 @@ predicate isSuspiciousPropertyName(PropertyRead pr) {
from DataFlow::PathNode src, DataFlow::PathNode sink, DataFlowFromMethodToHash conf
where conf.hasFlow(src.getNode(), sink.getNode())
select src.getNode(), src, sink,
- "The hash is calculated on the process name $@, may be related to a backdoor. Please review the code for possible malicious intent.",
- sink.getNode(), "here"
+ "The hash is calculated on $@, may be related to a backdoor. Please review the code for possible malicious intent.",
+ sink.getNode(), "this process name"
diff --git a/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll b/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll
index 8e863ddf635..7afe954023b 100644
--- a/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll
+++ b/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll
@@ -742,7 +742,7 @@ class NoOpInstruction extends Instruction {
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
* containing the `ExitFunction` instruction for that function.
*
- * There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
+ * There are two different return instructions: `ReturnValueInstruction`, for returning a value from
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
* `void`-returning function.
*/
@@ -1331,7 +1331,7 @@ class CheckedConvertOrThrowInstruction extends UnaryInstruction {
*
* If the operand holds a null address, the result is a null address.
*
- * This instruction is used to represent `dyanmic_cast` in C++, which returns the pointer to
+ * This instruction is used to represent `dynamic_cast` in C++, which returns the pointer to
* the most-derived object.
*/
class CompleteObjectAddressInstruction extends UnaryInstruction {
diff --git a/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedElement.qll b/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedElement.qll
index 7fc54f80b80..4c5ab431dd5 100644
--- a/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedElement.qll
+++ b/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedElement.qll
@@ -512,7 +512,7 @@ abstract class TranslatedElement extends TTranslatedElement {
/**
* If the instruction specified by `tag` has a result of type `UnknownType`,
- * gets the size of the result in bytes. If the result does not have a knonwn
+ * gets the size of the result in bytes. If the result does not have a known
* constant size, this predicate does not hold.
*/
int getInstructionResultSize(InstructionTag tag) { none() }
diff --git a/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedStmt.qll b/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedStmt.qll
index d95a73e4e42..1afc48d0409 100644
--- a/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedStmt.qll
+++ b/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedStmt.qll
@@ -403,7 +403,7 @@ class TranslatedGeneralCatchClause extends TranslatedClause {
/**
* The IR translation of a throw statement that throws an exception,
- * as oposed to just rethrowing one.
+ * as opposed to just rethrowing one.
*/
class TranslatedThrowExceptionStmt extends TranslatedStmt, InitializationContext {
override ThrowStmt stmt;
diff --git a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll
index 8e863ddf635..7afe954023b 100644
--- a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll
+++ b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll
@@ -742,7 +742,7 @@ class NoOpInstruction extends Instruction {
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
* containing the `ExitFunction` instruction for that function.
*
- * There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
+ * There are two different return instructions: `ReturnValueInstruction`, for returning a value from
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
* `void`-returning function.
*/
@@ -1331,7 +1331,7 @@ class CheckedConvertOrThrowInstruction extends UnaryInstruction {
*
* If the operand holds a null address, the result is a null address.
*
- * This instruction is used to represent `dyanmic_cast` in C++, which returns the pointer to
+ * This instruction is used to represent `dynamic_cast` in C++, which returns the pointer to
* the most-derived object.
*/
class CompleteObjectAddressInstruction extends UnaryInstruction {
diff --git a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
index d65ee10f402..efc927a05e6 100644
--- a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
+++ b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
@@ -64,7 +64,7 @@ private module Cached {
or
instr = reusedPhiInstruction(_) and
// Check that the phi instruction is *not* degenerate, but we can't use
- // getDegeneratePhiOperand in the first stage with phi instyructions
+ // getDegeneratePhiOperand in the first stage with phi instructions
not exists(
unique(OldIR::PhiInputOperand operand |
operand = instr.(OldIR::PhiInstruction).getAnInputOperand() and
@@ -718,7 +718,7 @@ module DefUse {
}
/**
- * Gets the rank index of a hyphothetical use one instruction past the end of
+ * Gets the rank index of a hypothetical use one instruction past the end of
* the block. This index can be used to determine if a definition reaches the
* end of the block, even if the definition is the last instruction in the
* block.
diff --git a/csharp/ql/src/meta/frameworks/UnsupportedExternalAPIs.ql b/csharp/ql/src/meta/frameworks/UnsupportedExternalAPIs.ql
index 1b19740e3ae..6332dfc515c 100644
--- a/csharp/ql/src/meta/frameworks/UnsupportedExternalAPIs.ql
+++ b/csharp/ql/src/meta/frameworks/UnsupportedExternalAPIs.ql
@@ -1,6 +1,6 @@
/**
* @name Usage of unsupported external library API
- * @description A call to an unsuppported external library API.
+ * @description A call to an unsupported external library API.
* @kind problem
* @problem.severity recommendation
* @tags meta
diff --git a/csharp/ql/src/qlpack.yml b/csharp/ql/src/qlpack.yml
index e2721c02552..682028cf7cc 100644
--- a/csharp/ql/src/qlpack.yml
+++ b/csharp/ql/src/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/csharp-queries
-version: 0.4.1-dev
+version: 0.4.2-dev
groups:
- csharp
- queries
diff --git a/csharp/ql/src/utils/model-generator/internal/CaptureModels.qll b/csharp/ql/src/utils/model-generator/internal/CaptureModels.qll
index 82c6fbd1bbb..82ac94c8fc4 100644
--- a/csharp/ql/src/utils/model-generator/internal/CaptureModels.qll
+++ b/csharp/ql/src/utils/model-generator/internal/CaptureModels.qll
@@ -247,7 +247,7 @@ string captureSource(DataFlowTargetApi api) {
* A TaintTracking Configuration used for tracking flow through APIs.
* The sources are the parameters of the API and the fields of the enclosing type.
*
- * This can be used to generate Sink summaries for APIs, if the API propgates a parameter (or enclosing type field)
+ * This can be used to generate Sink summaries for APIs, if the API propagates a parameter (or enclosing type field)
* into an existing known sink (then the API itself becomes a sink).
*/
private class PropagateToSinkConfiguration extends PropagateToSinkConfigurationSpecific {
diff --git a/csharp/ql/src/utils/model-generator/internal/CaptureModelsSpecific.qll b/csharp/ql/src/utils/model-generator/internal/CaptureModelsSpecific.qll
index 3b0a33336c0..bd8b227e76f 100644
--- a/csharp/ql/src/utils/model-generator/internal/CaptureModelsSpecific.qll
+++ b/csharp/ql/src/utils/model-generator/internal/CaptureModelsSpecific.qll
@@ -131,7 +131,7 @@ private CS::Parameter getParameter(DataFlowImplCommon::ReturnNodeExt node, Param
}
/**
- * Gets the CSV string represention of the the return node `node`.
+ * Gets the CSV string representation of the the return node `node`.
*/
string returnNodeAsOutput(DataFlowImplCommon::ReturnNodeExt node) {
if node.getKind() instanceof DataFlowImplCommon::ValueReturnKind
diff --git a/csharp/ql/test/experimental/CWE-918/RequestForgery.expected b/csharp/ql/test/experimental/CWE-918/RequestForgery.expected
index 70ba2594fdf..fb85f080a4c 100644
--- a/csharp/ql/test/experimental/CWE-918/RequestForgery.expected
+++ b/csharp/ql/test/experimental/CWE-918/RequestForgery.expected
@@ -5,4 +5,4 @@ nodes
| RequestForgery.cs:16:66:16:68 | access to parameter url | semmle.label | access to parameter url |
subpaths
#select
-| RequestForgery.cs:16:66:16:68 | access to parameter url | RequestForgery.cs:14:52:14:54 | url : String | RequestForgery.cs:16:66:16:68 | access to parameter url | $@ flows to here and is used in a server side web request. | RequestForgery.cs:14:52:14:54 | url | User-provided value |
+| RequestForgery.cs:16:66:16:68 | access to parameter url | RequestForgery.cs:14:52:14:54 | url : String | RequestForgery.cs:16:66:16:68 | access to parameter url | The URL of this request depends on a $@. | RequestForgery.cs:14:52:14:54 | url | user-provided value |
diff --git a/csharp/ql/test/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.expected b/csharp/ql/test/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.expected
index dc224c9586e..a76e9660cec 100644
--- a/csharp/ql/test/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.expected
+++ b/csharp/ql/test/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.expected
@@ -1,7 +1,7 @@
-| delegation-test.cs:101:63:101:186 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:54:34:54:50 | LifetimeValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.LifetimeValidator | delegation-test.cs:101:63:101:186 | (...) => ... | a callable that always returns "true" |
-| delegation-test.cs:102:63:102:178 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator | delegation-test.cs:102:63:102:178 | (...) => ... | a callable that always returns "true" |
-| delegation-test.cs:115:63:115:190 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator | delegation-test.cs:115:63:115:190 | (...) => ... | a callable that always returns "true" |
-| delegation-test.cs:116:63:116:180 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator | delegation-test.cs:116:63:116:180 | (...) => ... | a callable that always returns "true" |
-| delegation-test.cs:117:63:117:217 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator | delegation-test.cs:117:63:117:217 | (...) => ... | a callable that always returns "true" |
-| delegation-test.cs:118:63:118:248 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator | delegation-test.cs:118:63:118:248 | (...) => ... | a callable that always returns "true" |
-| delegation-test.cs:119:63:119:177 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to $@. | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator | delegation-test.cs:119:63:119:177 | (...) => ... | a callable that always returns "true" |
+| delegation-test.cs:101:63:101:186 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:54:34:54:50 | LifetimeValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.LifetimeValidator |
+| delegation-test.cs:102:63:102:178 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator |
+| delegation-test.cs:115:63:115:190 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator |
+| delegation-test.cs:116:63:116:180 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator |
+| delegation-test.cs:117:63:117:217 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator |
+| delegation-test.cs:118:63:118:248 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator |
+| delegation-test.cs:119:63:119:177 | (...) => ... | JsonWebTokenHandler security-sensitive property $@ is being delegated to this callable that always returns "true". | stubs.cs:55:34:55:50 | AudienceValidator | Microsoft.IdentityModel.Tokens.TokenValidationParameters.AudienceValidator |
diff --git a/csharp/ql/test/experimental/Security Features/backdoor/PotentialTimeBomb.expected b/csharp/ql/test/experimental/Security Features/backdoor/PotentialTimeBomb.expected
index 490a71b0c0c..4eef156a292 100644
--- a/csharp/ql/test/experimental/Security Features/backdoor/PotentialTimeBomb.expected
+++ b/csharp/ql/test/experimental/Security Features/backdoor/PotentialTimeBomb.expected
@@ -10,10 +10,10 @@ edges
| test.cs:70:36:70:70 | call to method AddHours : DateTime | test.cs:70:13:70:71 | call to method CompareTo |
| test.cs:70:36:70:70 | call to method AddHours : DateTime | test.cs:70:13:70:71 | call to method CompareTo : Int32 |
#select
-| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:71 | call to method CompareTo | Possible TimeBomb logic triggered by $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | an offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
-| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:71 | call to method CompareTo : Int32 | Possible TimeBomb logic triggered by $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | an offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
-| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:76 | ... >= ... | Possible TimeBomb logic triggered by $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | an offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
-| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:76 | ... >= ... : Boolean | Possible TimeBomb logic triggered by $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | an offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
+| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:71 | call to method CompareTo | Possible TimeBomb logic triggered by an $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
+| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:71 | call to method CompareTo : Int32 | Possible TimeBomb logic triggered by an $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
+| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:76 | ... >= ... | Possible TimeBomb logic triggered by an $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
+| test.cs:70:9:73:9 | if (...) ... | test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | test.cs:70:13:70:76 | ... >= ... : Boolean | Possible TimeBomb logic triggered by an $@ that takes into account $@ from the $@ as part of the potential trigger. | test.cs:70:13:70:71 | call to method CompareTo | call to method CompareTo | test.cs:70:36:70:70 | call to method AddHours | offset | test.cs:68:34:68:76 | call to method GetLastWriteTime | last modification time of a file |
nodes
| test.cs:68:34:68:76 | call to method GetLastWriteTime : DateTime | semmle.label | call to method GetLastWriteTime : DateTime |
| test.cs:70:13:70:71 | call to method CompareTo | semmle.label | call to method CompareTo |
diff --git a/csharp/ql/test/query-tests/API Abuse/ClassDoesNotImplementEquals/ClassDoesNotImplementEquals.expected b/csharp/ql/test/query-tests/API Abuse/ClassDoesNotImplementEquals/ClassDoesNotImplementEquals.expected
index 107f4e418f0..76c0724bb40 100644
--- a/csharp/ql/test/query-tests/API Abuse/ClassDoesNotImplementEquals/ClassDoesNotImplementEquals.expected
+++ b/csharp/ql/test/query-tests/API Abuse/ClassDoesNotImplementEquals/ClassDoesNotImplementEquals.expected
@@ -1,5 +1,5 @@
| ClassDoesNotImplementEquals.cs:4:7:4:15 | Incorrect | Class 'Incorrect' does not implement Equals(object), but it implements $@. | ClassDoesNotImplementEquals.cs:6:33:6:34 | == | operator == |
+| ClassDoesNotImplementEquals.cs:24:7:24:24 | IncorrectOverrides | Class 'IncorrectOverrides' does not implement Equals(object), but $@. | ClassDoesNotImplementEquals.cs:42:17:42:53 | call to method Equals | 'Equals' is called on an instance of this class |
| ClassDoesNotImplementEquals.cs:24:7:24:24 | IncorrectOverrides | Class 'IncorrectOverrides' does not implement Equals(object), but it implements $@. | ClassDoesNotImplementEquals.cs:26:33:26:34 | == | operator == |
-| ClassDoesNotImplementEquals.cs:24:7:24:24 | IncorrectOverrides | Class 'IncorrectOverrides' does not implement Equals(object), but it is called $@. | ClassDoesNotImplementEquals.cs:42:17:42:53 | call to method Equals | here |
| ClassDoesNotImplementEquals.cs:50:7:50:17 | MyEquatable | Class 'MyEquatable' does not implement Equals(object), but it implements $@. | ClassDoesNotImplementEquals.cs:52:17:52:22 | Equals | IEquatable.Equals |
-| ClassDoesNotImplementEqualsBad.cs:24:11:24:21 | GasolineCar | Class 'GasolineCar' does not implement Equals(object), but it is called $@. | ClassDoesNotImplementEqualsBad.cs:38:38:38:54 | call to method Equals | here |
+| ClassDoesNotImplementEqualsBad.cs:24:11:24:21 | GasolineCar | Class 'GasolineCar' does not implement Equals(object), but $@. | ClassDoesNotImplementEqualsBad.cs:38:38:38:54 | call to method Equals | 'Equals' is called on an instance of this class |
diff --git a/csharp/ql/test/query-tests/API Abuse/NoDisposeCallOnLocalIDisposable/NoDisposeCallOnLocalIDisposable.expected b/csharp/ql/test/query-tests/API Abuse/NoDisposeCallOnLocalIDisposable/NoDisposeCallOnLocalIDisposable.expected
index 9894cc8790a..e96638e6076 100644
--- a/csharp/ql/test/query-tests/API Abuse/NoDisposeCallOnLocalIDisposable/NoDisposeCallOnLocalIDisposable.expected
+++ b/csharp/ql/test/query-tests/API Abuse/NoDisposeCallOnLocalIDisposable/NoDisposeCallOnLocalIDisposable.expected
@@ -1,5 +1,5 @@
-| NoDisposeCallOnLocalIDisposable.cs:50:19:50:38 | object creation of type Timer | Disposable 'Timer' is created here but is not disposed. |
-| NoDisposeCallOnLocalIDisposable.cs:51:18:51:73 | object creation of type FileStream | Disposable 'FileStream' is created here but is not disposed. |
-| NoDisposeCallOnLocalIDisposable.cs:52:9:52:64 | object creation of type FileStream | Disposable 'FileStream' is created here but is not disposed. |
-| NoDisposeCallOnLocalIDisposable.cs:74:25:74:71 | call to method Create | Disposable 'XmlReader' is created here but is not disposed. |
-| NoDisposeCallOnLocalIDisposableBad.cs:8:22:8:56 | object creation of type FileStream | Disposable 'FileStream' is created here but is not disposed. |
+| NoDisposeCallOnLocalIDisposable.cs:50:19:50:38 | object creation of type Timer | Disposable 'Timer' is created but not disposed. |
+| NoDisposeCallOnLocalIDisposable.cs:51:18:51:73 | object creation of type FileStream | Disposable 'FileStream' is created but not disposed. |
+| NoDisposeCallOnLocalIDisposable.cs:52:9:52:64 | object creation of type FileStream | Disposable 'FileStream' is created but not disposed. |
+| NoDisposeCallOnLocalIDisposable.cs:74:25:74:71 | call to method Create | Disposable 'XmlReader' is created but not disposed. |
+| NoDisposeCallOnLocalIDisposableBad.cs:8:22:8:56 | object creation of type FileStream | Disposable 'FileStream' is created but not disposed. |
diff --git a/csharp/ql/test/query-tests/Concurrency/SynchSetUnsynchGet/SynchSetUnsynchGet.expected b/csharp/ql/test/query-tests/Concurrency/SynchSetUnsynchGet/SynchSetUnsynchGet.expected
index 28f9f8bb94c..9e2c2e0c820 100644
--- a/csharp/ql/test/query-tests/Concurrency/SynchSetUnsynchGet/SynchSetUnsynchGet.expected
+++ b/csharp/ql/test/query-tests/Concurrency/SynchSetUnsynchGet/SynchSetUnsynchGet.expected
@@ -1,2 +1,2 @@
-| SynchSetUnsynchGet.cs:9:9:9:20 | BadProperty1 | Field '$@' is guarded by a lock in the setter but not in the getter. | SynchSetUnsynchGet.cs:5:9:5:17 | property1 | property1 |
-| SynchSetUnsynchGet.cs:23:9:23:20 | BadProperty2 | Field '$@' is guarded by a lock in the setter but not in the getter. | SynchSetUnsynchGet.cs:5:9:5:17 | property1 | property1 |
+| SynchSetUnsynchGet.cs:9:9:9:20 | BadProperty1 | Field $@ is guarded by a lock in the setter but not in the getter. | SynchSetUnsynchGet.cs:5:9:5:17 | property1 | property1 |
+| SynchSetUnsynchGet.cs:23:9:23:20 | BadProperty2 | Field $@ is guarded by a lock in the setter but not in the getter. | SynchSetUnsynchGet.cs:5:9:5:17 | property1 | property1 |
diff --git a/csharp/ql/test/query-tests/Dead Code/NonAssignedFields/NonAssignedFields.expected b/csharp/ql/test/query-tests/Dead Code/NonAssignedFields/NonAssignedFields.expected
index e6cb8e7043b..854ce5c1c8f 100644
--- a/csharp/ql/test/query-tests/Dead Code/NonAssignedFields/NonAssignedFields.expected
+++ b/csharp/ql/test/query-tests/Dead Code/NonAssignedFields/NonAssignedFields.expected
@@ -1,2 +1,2 @@
-| NonAssignedFields.cs:87:9:87:22 | BadNonAssigned | The field 'BadNonAssigned' is never explicitly assigned a value, yet it is read $@. | NonAssignedFields.cs:109:20:109:33 | access to field BadNonAssigned | here |
-| NonAssignedFields.cs:88:12:88:26 | BadAssignedNull | The field 'BadAssignedNull' is never explicitly assigned a value, yet it is read $@. | NonAssignedFields.cs:113:13:113:27 | access to field BadAssignedNull | here |
+| NonAssignedFields.cs:87:9:87:22 | BadNonAssigned | The field 'BadNonAssigned' is never explicitly assigned a value, yet $@. | NonAssignedFields.cs:109:20:109:33 | access to field BadNonAssigned | the field is read |
+| NonAssignedFields.cs:88:12:88:26 | BadAssignedNull | The field 'BadAssignedNull' is never explicitly assigned a value, yet $@. | NonAssignedFields.cs:113:13:113:27 | access to field BadAssignedNull | the field is read |
diff --git a/csharp/ql/test/query-tests/Dead Code/Tests/UnusedField.expected b/csharp/ql/test/query-tests/Dead Code/Tests/UnusedField.expected
index 6210e7f928a..de8109fc505 100644
--- a/csharp/ql/test/query-tests/Dead Code/Tests/UnusedField.expected
+++ b/csharp/ql/test/query-tests/Dead Code/Tests/UnusedField.expected
@@ -1,5 +1,5 @@
-| deadcode.cs:85:7:85:11 | Field | Unused field (or field used from dead method only) |
-| regression.cs:7:20:7:23 | dead | Unused field (or field used from dead method only) |
-| regression.cs:113:9:113:17 | deadField | Unused field (or field used from dead method only) |
-| regression.cs:116:9:116:24 | deadWrittenField | Unused field (or field used from dead method only) |
-| regression.cs:129:9:129:17 | deadField | Unused field (or field used from dead method only) |
+| deadcode.cs:85:7:85:11 | Field | Unused field (or field used from dead method only). |
+| regression.cs:7:20:7:23 | dead | Unused field (or field used from dead method only). |
+| regression.cs:113:9:113:17 | deadField | Unused field (or field used from dead method only). |
+| regression.cs:116:9:116:24 | deadWrittenField | Unused field (or field used from dead method only). |
+| regression.cs:129:9:129:17 | deadField | Unused field (or field used from dead method only). |
diff --git a/csharp/ql/test/query-tests/Dead Code/Tests/UnusedMethod.expected b/csharp/ql/test/query-tests/Dead Code/Tests/UnusedMethod.expected
index 081fb380a25..e868944473c 100644
--- a/csharp/ql/test/query-tests/Dead Code/Tests/UnusedMethod.expected
+++ b/csharp/ql/test/query-tests/Dead Code/Tests/UnusedMethod.expected
@@ -1,6 +1,6 @@
-| regression.cs:51:18:51:33 | ActualDeadMethod | Unused method (or method called from dead method only) |
-| regression.cs:60:18:60:37 | NotDynamicallyCalled | Unused method (or method called from dead method only) |
-| regression.cs:77:10:77:19 | DeadCaller | Unused method (or method called from dead method only) |
-| regression.cs:84:10:84:23 | DeadGeneric<> | Unused method (or method called from dead method only) |
-| regression.cs:105:10:105:21 | DeadGeneric1 | Unused method (or method called from dead method only) |
-| regression.cs:110:10:110:24 | DeadGeneric2<> | Unused method (or method called from dead method only) |
+| regression.cs:51:18:51:33 | ActualDeadMethod | Unused method (or method called from dead method only). |
+| regression.cs:60:18:60:37 | NotDynamicallyCalled | Unused method (or method called from dead method only). |
+| regression.cs:77:10:77:19 | DeadCaller | Unused method (or method called from dead method only). |
+| regression.cs:84:10:84:23 | DeadGeneric<> | Unused method (or method called from dead method only). |
+| regression.cs:105:10:105:21 | DeadGeneric1 | Unused method (or method called from dead method only). |
+| regression.cs:110:10:110:24 | DeadGeneric2<> | Unused method (or method called from dead method only). |
diff --git a/csharp/ql/test/query-tests/Language Abuse/ForeachCapture/ForeachCapture.expected b/csharp/ql/test/query-tests/Language Abuse/ForeachCapture/ForeachCapture.expected
index 4be5dbe7f3a..38127a4a764 100644
--- a/csharp/ql/test/query-tests/Language Abuse/ForeachCapture/ForeachCapture.expected
+++ b/csharp/ql/test/query-tests/Language Abuse/ForeachCapture/ForeachCapture.expected
@@ -1,2 +1,2 @@
-| ForeachCapture.cs:14:23:14:31 | (...) => ... | Function which may be stored in $@ captures variable $@ | ForeachCapture.cs:7:22:7:27 | event1 | event1 | ForeachCapture.cs:11:22:11:24 | arg | arg |
-| ForeachCapture.cs:24:30:24:38 | (...) => ... | Function which may be stored in $@ captures variable $@ | ForeachCapture.cs:41:22:41:28 | actions | actions | ForeachCapture.cs:11:22:11:24 | arg | arg |
+| ForeachCapture.cs:14:23:14:31 | (...) => ... | Function which may be stored in $@ captures variable $@. | ForeachCapture.cs:7:22:7:27 | event1 | event1 | ForeachCapture.cs:11:22:11:24 | arg | arg |
+| ForeachCapture.cs:24:30:24:38 | (...) => ... | Function which may be stored in $@ captures variable $@. | ForeachCapture.cs:41:22:41:28 | actions | actions | ForeachCapture.cs:11:22:11:24 | arg | arg |
diff --git a/csharp/ql/test/query-tests/Language Abuse/UselessIsBeforeAs/UselessIsBeforeAs.expected b/csharp/ql/test/query-tests/Language Abuse/UselessIsBeforeAs/UselessIsBeforeAs.expected
index f67e589d984..d78a6de3769 100644
--- a/csharp/ql/test/query-tests/Language Abuse/UselessIsBeforeAs/UselessIsBeforeAs.expected
+++ b/csharp/ql/test/query-tests/Language Abuse/UselessIsBeforeAs/UselessIsBeforeAs.expected
@@ -1 +1 @@
-| UselessIsBeforeAs.cs:8:21:8:31 | ... as ... | This 'as' expression performs a type test - it should be directly compared against null, rendering the 'is' $@ potentially redundant. | UselessIsBeforeAs.cs:5:13:5:23 | ... is ... | here |
+| UselessIsBeforeAs.cs:8:21:8:31 | ... as ... | This 'as' expression performs a type test - it should be directly compared against null, rendering the $@ potentially redundant. | UselessIsBeforeAs.cs:5:13:5:23 | ... is ... | is |
diff --git a/csharp/ql/test/query-tests/Nullness/NullAlways.expected b/csharp/ql/test/query-tests/Nullness/NullAlways.expected
index 7a546051436..4c2d21d4fca 100644
--- a/csharp/ql/test/query-tests/Nullness/NullAlways.expected
+++ b/csharp/ql/test/query-tests/Nullness/NullAlways.expected
@@ -1,42 +1,42 @@
-| A.cs:8:15:8:32 | access to local variable synchronizedAlways | Variable $@ is always null here. | A.cs:7:16:7:33 | synchronizedAlways | synchronizedAlways |
-| A.cs:17:9:17:17 | access to local variable arrayNull | Variable $@ is always null here. | A.cs:16:15:16:23 | arrayNull | arrayNull |
-| A.cs:31:27:31:37 | access to local variable arrayAccess | Variable $@ is always null here. | A.cs:26:15:26:25 | arrayAccess | arrayAccess |
-| A.cs:32:27:32:37 | access to local variable fieldAccess | Variable $@ is always null here. | A.cs:27:18:27:28 | fieldAccess | fieldAccess |
-| A.cs:33:28:33:39 | access to local variable methodAccess | Variable $@ is always null here. | A.cs:28:16:28:27 | methodAccess | methodAccess |
-| A.cs:34:27:34:36 | access to local variable methodCall | Variable $@ is always null here. | A.cs:29:16:29:25 | methodCall | methodCall |
-| A.cs:50:9:50:14 | access to local variable varRef | Variable $@ is always null here. | A.cs:48:16:48:21 | varRef | varRef |
-| Assert.cs:15:27:15:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
-| Assert.cs:23:27:23:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
-| Assert.cs:31:27:31:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
-| Assert.cs:47:27:47:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
-| Assert.cs:51:27:51:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
-| B.cs:13:13:13:24 | access to local variable eqCallAlways | Variable $@ is always null here. | B.cs:7:11:7:22 | eqCallAlways | eqCallAlways |
-| B.cs:24:13:24:25 | access to local variable neqCallAlways | Variable $@ is always null here. | B.cs:10:11:10:23 | neqCallAlways | neqCallAlways |
-| C.cs:18:13:18:13 | access to local variable o | Variable $@ is always null here. | C.cs:10:16:10:16 | o | o |
-| C.cs:42:9:42:9 | access to local variable s | Variable $@ is always null here. | C.cs:40:13:40:13 | s | s |
-| C.cs:57:9:57:10 | access to local variable o2 | Variable $@ is always null here. | C.cs:55:13:55:14 | o2 | o2 |
-| C.cs:162:13:162:13 | access to local variable s | Variable $@ is always null here. | C.cs:151:13:151:13 | s | s |
-| C.cs:170:13:170:13 | access to local variable s | Variable $@ is always null here. | C.cs:151:13:151:13 | s | s |
-| C.cs:196:13:196:13 | access to local variable s | Variable $@ is always null here. | C.cs:185:13:185:13 | s | s |
-| C.cs:218:13:218:13 | access to local variable s | Variable $@ is always null here. | C.cs:210:13:210:13 | s | s |
-| C.cs:233:9:233:9 | access to local variable s | Variable $@ is always null here. | C.cs:228:16:228:16 | s | s |
-| C.cs:237:13:237:13 | access to local variable s | Variable $@ is always null here. | C.cs:228:16:228:16 | s | s |
-| C.cs:249:9:249:9 | access to local variable a | Variable $@ is always null here. | C.cs:248:15:248:15 | a | a |
-| C.cs:260:9:260:10 | access to local variable ia | Variable $@ is always null here. | C.cs:257:15:257:16 | ia | ia |
-| C.cs:261:20:261:21 | access to local variable sa | Variable $@ is always null here. | C.cs:258:18:258:19 | sa | sa |
-| D.cs:120:13:120:13 | access to local variable x | Variable $@ is always null here. | D.cs:117:13:117:13 | x | x |
-| D.cs:197:13:197:13 | access to local variable o | Variable $@ is always null here. | D.cs:195:13:195:13 | o | o |
-| D.cs:207:17:207:17 | access to local variable e | Variable $@ is always null here. | D.cs:204:26:204:26 | e | e |
-| D.cs:217:13:217:14 | access to local variable o3 | Variable $@ is always null here. | D.cs:215:13:215:14 | o3 | o3 |
-| D.cs:222:13:222:14 | access to local variable o4 | Variable $@ is always null here. | D.cs:220:13:220:14 | o4 | o4 |
-| D.cs:385:13:385:15 | access to local variable ioe | Variable $@ is always null here. | D.cs:378:19:378:21 | ioe | ioe |
-| E.cs:210:16:210:16 | access to parameter s | Variable $@ is always null here. | E.cs:206:28:206:28 | s | s |
-| E.cs:220:13:220:13 | access to local variable x | Variable $@ is always null here. | E.cs:215:13:215:13 | x | x |
-| E.cs:229:13:229:13 | access to local variable x | Variable $@ is always null here. | E.cs:225:13:225:13 | x | x |
-| E.cs:323:13:323:14 | access to parameter s1 | Variable $@ is always null here. | E.cs:319:29:319:30 | s1 | s1 |
-| E.cs:324:13:324:14 | access to parameter s2 | Variable $@ is always null here. | E.cs:319:40:319:41 | s2 | s2 |
-| E.cs:331:9:331:9 | access to local variable x | Variable $@ is always null here. | E.cs:330:13:330:13 | x | x |
-| E.cs:405:16:405:16 | access to local variable i | Variable $@ is always null here. | E.cs:403:14:403:14 | i | i |
-| Forwarding.cs:36:31:36:31 | access to local variable s | Variable $@ is always null here. | Forwarding.cs:7:16:7:16 | s | s |
-| Forwarding.cs:40:27:40:27 | access to local variable s | Variable $@ is always null here. | Forwarding.cs:7:16:7:16 | s | s |
-| NullAlwaysBad.cs:9:30:9:30 | access to parameter s | Variable $@ is always null here. | NullAlwaysBad.cs:7:29:7:29 | s | s |
+| A.cs:8:15:8:32 | access to local variable synchronizedAlways | Variable $@ is always null at this dereference. | A.cs:7:16:7:33 | synchronizedAlways | synchronizedAlways |
+| A.cs:17:9:17:17 | access to local variable arrayNull | Variable $@ is always null at this dereference. | A.cs:16:15:16:23 | arrayNull | arrayNull |
+| A.cs:31:27:31:37 | access to local variable arrayAccess | Variable $@ is always null at this dereference. | A.cs:26:15:26:25 | arrayAccess | arrayAccess |
+| A.cs:32:27:32:37 | access to local variable fieldAccess | Variable $@ is always null at this dereference. | A.cs:27:18:27:28 | fieldAccess | fieldAccess |
+| A.cs:33:28:33:39 | access to local variable methodAccess | Variable $@ is always null at this dereference. | A.cs:28:16:28:27 | methodAccess | methodAccess |
+| A.cs:34:27:34:36 | access to local variable methodCall | Variable $@ is always null at this dereference. | A.cs:29:16:29:25 | methodCall | methodCall |
+| A.cs:50:9:50:14 | access to local variable varRef | Variable $@ is always null at this dereference. | A.cs:48:16:48:21 | varRef | varRef |
+| Assert.cs:15:27:15:27 | access to local variable s | Variable $@ is always null at this dereference. | Assert.cs:9:16:9:16 | s | s |
+| Assert.cs:23:27:23:27 | access to local variable s | Variable $@ is always null at this dereference. | Assert.cs:9:16:9:16 | s | s |
+| Assert.cs:31:27:31:27 | access to local variable s | Variable $@ is always null at this dereference. | Assert.cs:9:16:9:16 | s | s |
+| Assert.cs:47:27:47:27 | access to local variable s | Variable $@ is always null at this dereference. | Assert.cs:9:16:9:16 | s | s |
+| Assert.cs:51:27:51:27 | access to local variable s | Variable $@ is always null at this dereference. | Assert.cs:9:16:9:16 | s | s |
+| B.cs:13:13:13:24 | access to local variable eqCallAlways | Variable $@ is always null at this dereference. | B.cs:7:11:7:22 | eqCallAlways | eqCallAlways |
+| B.cs:24:13:24:25 | access to local variable neqCallAlways | Variable $@ is always null at this dereference. | B.cs:10:11:10:23 | neqCallAlways | neqCallAlways |
+| C.cs:18:13:18:13 | access to local variable o | Variable $@ is always null at this dereference. | C.cs:10:16:10:16 | o | o |
+| C.cs:42:9:42:9 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:40:13:40:13 | s | s |
+| C.cs:57:9:57:10 | access to local variable o2 | Variable $@ is always null at this dereference. | C.cs:55:13:55:14 | o2 | o2 |
+| C.cs:162:13:162:13 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:151:13:151:13 | s | s |
+| C.cs:170:13:170:13 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:151:13:151:13 | s | s |
+| C.cs:196:13:196:13 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:185:13:185:13 | s | s |
+| C.cs:218:13:218:13 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:210:13:210:13 | s | s |
+| C.cs:233:9:233:9 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:228:16:228:16 | s | s |
+| C.cs:237:13:237:13 | access to local variable s | Variable $@ is always null at this dereference. | C.cs:228:16:228:16 | s | s |
+| C.cs:249:9:249:9 | access to local variable a | Variable $@ is always null at this dereference. | C.cs:248:15:248:15 | a | a |
+| C.cs:260:9:260:10 | access to local variable ia | Variable $@ is always null at this dereference. | C.cs:257:15:257:16 | ia | ia |
+| C.cs:261:20:261:21 | access to local variable sa | Variable $@ is always null at this dereference. | C.cs:258:18:258:19 | sa | sa |
+| D.cs:120:13:120:13 | access to local variable x | Variable $@ is always null at this dereference. | D.cs:117:13:117:13 | x | x |
+| D.cs:197:13:197:13 | access to local variable o | Variable $@ is always null at this dereference. | D.cs:195:13:195:13 | o | o |
+| D.cs:207:17:207:17 | access to local variable e | Variable $@ is always null at this dereference. | D.cs:204:26:204:26 | e | e |
+| D.cs:217:13:217:14 | access to local variable o3 | Variable $@ is always null at this dereference. | D.cs:215:13:215:14 | o3 | o3 |
+| D.cs:222:13:222:14 | access to local variable o4 | Variable $@ is always null at this dereference. | D.cs:220:13:220:14 | o4 | o4 |
+| D.cs:385:13:385:15 | access to local variable ioe | Variable $@ is always null at this dereference. | D.cs:378:19:378:21 | ioe | ioe |
+| E.cs:210:16:210:16 | access to parameter s | Variable $@ is always null at this dereference. | E.cs:206:28:206:28 | s | s |
+| E.cs:220:13:220:13 | access to local variable x | Variable $@ is always null at this dereference. | E.cs:215:13:215:13 | x | x |
+| E.cs:229:13:229:13 | access to local variable x | Variable $@ is always null at this dereference. | E.cs:225:13:225:13 | x | x |
+| E.cs:323:13:323:14 | access to parameter s1 | Variable $@ is always null at this dereference. | E.cs:319:29:319:30 | s1 | s1 |
+| E.cs:324:13:324:14 | access to parameter s2 | Variable $@ is always null at this dereference. | E.cs:319:40:319:41 | s2 | s2 |
+| E.cs:331:9:331:9 | access to local variable x | Variable $@ is always null at this dereference. | E.cs:330:13:330:13 | x | x |
+| E.cs:405:16:405:16 | access to local variable i | Variable $@ is always null at this dereference. | E.cs:403:14:403:14 | i | i |
+| Forwarding.cs:36:31:36:31 | access to local variable s | Variable $@ is always null at this dereference. | Forwarding.cs:7:16:7:16 | s | s |
+| Forwarding.cs:40:27:40:27 | access to local variable s | Variable $@ is always null at this dereference. | Forwarding.cs:7:16:7:16 | s | s |
+| NullAlwaysBad.cs:9:30:9:30 | access to parameter s | Variable $@ is always null at this dereference. | NullAlwaysBad.cs:7:29:7:29 | s | s |
diff --git a/csharp/ql/test/query-tests/Nullness/NullMaybe.expected b/csharp/ql/test/query-tests/Nullness/NullMaybe.expected
index 39bc2d17684..e0721446b2f 100644
--- a/csharp/ql/test/query-tests/Nullness/NullMaybe.expected
+++ b/csharp/ql/test/query-tests/Nullness/NullMaybe.expected
@@ -829,88 +829,88 @@ edges
| StringConcatenation.cs:14:16:14:23 | SSA def(s) | StringConcatenation.cs:15:16:15:16 | access to local variable s |
| StringConcatenation.cs:15:16:15:16 | access to local variable s | StringConcatenation.cs:16:17:16:17 | access to local variable s |
#select
-| C.cs:64:9:64:10 | access to local variable o1 | C.cs:62:13:62:46 | SSA def(o1) | C.cs:64:9:64:10 | access to local variable o1 | Variable $@ may be null here because of $@ assignment. | C.cs:62:13:62:14 | o1 | o1 | C.cs:62:13:62:46 | Object o1 = ... | this |
-| C.cs:68:9:68:10 | access to local variable o2 | C.cs:66:13:66:46 | SSA def(o2) | C.cs:68:9:68:10 | access to local variable o2 | Variable $@ may be null here because of $@ assignment. | C.cs:66:13:66:14 | o2 | o2 | C.cs:66:13:66:46 | Object o2 = ... | this |
-| C.cs:95:15:95:15 | access to local variable o | C.cs:94:13:94:45 | SSA def(o) | C.cs:95:15:95:15 | access to local variable o | Variable $@ may be null here because of $@ assignment. | C.cs:94:13:94:13 | o | o | C.cs:94:13:94:45 | Object o = ... | this |
-| C.cs:103:27:103:30 | access to parameter list | C.cs:102:13:102:23 | SSA def(list) | C.cs:103:27:103:30 | access to parameter list | Variable $@ may be null here because of $@ assignment. | C.cs:99:42:99:45 | list | list | C.cs:102:13:102:23 | ... = ... | this |
-| C.cs:177:13:177:13 | access to local variable s | C.cs:178:13:178:20 | SSA def(s) | C.cs:177:13:177:13 | access to local variable s | Variable $@ may be null here because of $@ assignment. | C.cs:151:13:151:13 | s | s | C.cs:178:13:178:20 | ... = ... | this |
-| C.cs:203:13:203:13 | access to local variable s | C.cs:204:13:204:20 | SSA def(s) | C.cs:203:13:203:13 | access to local variable s | Variable $@ may be null here because of $@ assignment. | C.cs:185:13:185:13 | s | s | C.cs:204:13:204:20 | ... = ... | this |
-| C.cs:223:9:223:9 | access to local variable s | C.cs:222:13:222:20 | SSA def(s) | C.cs:223:9:223:9 | access to local variable s | Variable $@ may be null here because of $@ assignment. | C.cs:210:13:210:13 | s | s | C.cs:222:13:222:20 | ... = ... | this |
-| C.cs:242:13:242:13 | access to local variable s | C.cs:240:24:240:31 | SSA def(s) | C.cs:242:13:242:13 | access to local variable s | Variable $@ may be null here because of $@ assignment. | C.cs:228:16:228:16 | s | s | C.cs:240:24:240:31 | ... = ... | this |
-| D.cs:23:9:23:13 | access to parameter param | D.cs:17:17:17:20 | null | D.cs:23:9:23:13 | access to parameter param | Variable $@ may be null here because of $@ null argument. | D.cs:21:32:21:36 | param | param | D.cs:17:17:17:20 | null | this |
-| D.cs:32:9:32:13 | access to parameter param | D.cs:26:32:26:36 | SSA param(param) | D.cs:32:9:32:13 | access to parameter param | Variable $@ may be null here as suggested by $@ null check. | D.cs:26:32:26:36 | param | param | D.cs:28:13:28:25 | ... != ... | this |
-| D.cs:62:13:62:14 | access to local variable o5 | D.cs:58:13:58:41 | SSA def(o5) | D.cs:62:13:62:14 | access to local variable o5 | Variable $@ may be null here because of $@ assignment. | D.cs:58:13:58:14 | o5 | o5 | D.cs:58:13:58:41 | String o5 = ... | this |
-| D.cs:73:13:73:14 | access to local variable o7 | D.cs:68:13:68:34 | SSA def(o7) | D.cs:73:13:73:14 | access to local variable o7 | Variable $@ may be null here because of $@ assignment. | D.cs:68:13:68:14 | o7 | o7 | D.cs:68:13:68:34 | String o7 = ... | this |
-| D.cs:82:13:82:14 | access to local variable o8 | D.cs:75:13:75:34 | SSA def(o8) | D.cs:82:13:82:14 | access to local variable o8 | Variable $@ may be null here because of $@ assignment. | D.cs:75:13:75:14 | o8 | o8 | D.cs:75:13:75:34 | String o8 = ... | this |
-| D.cs:84:13:84:14 | access to local variable o8 | D.cs:75:13:75:34 | SSA def(o8) | D.cs:84:13:84:14 | access to local variable o8 | Variable $@ may be null here because of $@ assignment. | D.cs:75:13:75:14 | o8 | o8 | D.cs:75:13:75:34 | String o8 = ... | this |
-| D.cs:91:13:91:14 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:91:13:91:14 | access to local variable xs | Variable $@ may be null here because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
-| D.cs:94:21:94:22 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:94:21:94:22 | access to local variable xs | Variable $@ may be null here because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
-| D.cs:98:21:98:22 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:98:21:98:22 | access to local variable xs | Variable $@ may be null here because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
-| D.cs:102:31:102:32 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:102:31:102:32 | access to local variable xs | Variable $@ may be null here because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
-| D.cs:105:19:105:20 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:105:19:105:20 | access to local variable xs | Variable $@ may be null here because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
-| D.cs:134:24:134:24 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:134:24:134:24 | access to parameter a | Variable $@ may be null here as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:127:20:127:28 | ... == ... | this |
-| D.cs:134:24:134:24 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:134:24:134:24 | access to parameter a | Variable $@ may be null here as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:139:13:139:21 | ... != ... | this |
-| D.cs:135:24:135:24 | access to parameter b | D.cs:125:44:125:44 | SSA param(b) | D.cs:135:24:135:24 | access to parameter b | Variable $@ may be null here as suggested by $@ null check. | D.cs:125:44:125:44 | b | b | D.cs:128:20:128:28 | ... == ... | this |
-| D.cs:145:20:145:20 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:145:20:145:20 | access to parameter a | Variable $@ may be null here as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:127:20:127:28 | ... == ... | this |
-| D.cs:145:20:145:20 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:145:20:145:20 | access to parameter a | Variable $@ may be null here as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:139:13:139:21 | ... != ... | this |
-| D.cs:151:9:151:11 | access to parameter obj | D.cs:149:36:149:38 | SSA param(obj) | D.cs:151:9:151:11 | access to parameter obj | Variable $@ may be null here as suggested by $@ null check. | D.cs:149:36:149:38 | obj | obj | D.cs:152:17:152:27 | ... != ... | this |
-| D.cs:171:9:171:11 | access to local variable obj | D.cs:163:16:163:25 | SSA def(obj) | D.cs:171:9:171:11 | access to local variable obj | Variable $@ may be null here because of $@ assignment. | D.cs:163:16:163:18 | obj | obj | D.cs:163:16:163:25 | Object obj = ... | this |
-| D.cs:245:13:245:13 | access to local variable o | D.cs:240:9:240:16 | SSA def(o) | D.cs:245:13:245:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:228:16:228:16 | o | o | D.cs:240:9:240:16 | ... = ... | this |
-| D.cs:247:13:247:13 | access to local variable o | D.cs:240:9:240:16 | SSA def(o) | D.cs:247:13:247:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:228:16:228:16 | o | o | D.cs:240:9:240:16 | ... = ... | this |
-| D.cs:253:13:253:14 | access to local variable o2 | D.cs:249:13:249:38 | SSA def(o2) | D.cs:253:13:253:14 | access to local variable o2 | Variable $@ may be null here because of $@ assignment. | D.cs:249:13:249:14 | o2 | o2 | D.cs:249:13:249:38 | String o2 = ... | this |
-| D.cs:267:13:267:13 | access to local variable o | D.cs:258:16:258:23 | SSA def(o) | D.cs:267:13:267:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:258:16:258:23 | Object o = ... | this |
-| D.cs:291:13:291:13 | access to local variable o | D.cs:269:9:269:16 | SSA def(o) | D.cs:291:13:291:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:269:9:269:16 | ... = ... | this |
-| D.cs:291:13:291:13 | access to local variable o | D.cs:283:17:283:24 | SSA def(o) | D.cs:291:13:291:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:283:17:283:24 | ... = ... | this |
-| D.cs:294:13:294:13 | access to local variable o | D.cs:269:9:269:16 | SSA def(o) | D.cs:294:13:294:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:269:9:269:16 | ... = ... | this |
-| D.cs:294:13:294:13 | access to local variable o | D.cs:283:17:283:24 | SSA def(o) | D.cs:294:13:294:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:283:17:283:24 | ... = ... | this |
-| D.cs:300:17:300:20 | access to local variable prev | D.cs:296:16:296:26 | SSA def(prev) | D.cs:300:17:300:20 | access to local variable prev | Variable $@ may be null here because of $@ assignment. | D.cs:296:16:296:19 | prev | prev | D.cs:296:16:296:26 | Object prev = ... | this |
-| D.cs:313:17:313:17 | access to local variable s | D.cs:304:16:304:23 | SSA def(s) | D.cs:313:17:313:17 | access to local variable s | Variable $@ may be null here because of $@ assignment. | D.cs:304:16:304:16 | s | s | D.cs:304:16:304:23 | String s = ... | this |
-| D.cs:324:9:324:9 | access to local variable r | D.cs:316:16:316:23 | SSA def(r) | D.cs:324:9:324:9 | access to local variable r | Variable $@ may be null here because of $@ assignment. | D.cs:316:16:316:16 | r | r | D.cs:316:16:316:23 | Object r = ... | this |
-| D.cs:356:13:356:13 | access to local variable a | D.cs:351:15:351:22 | SSA def(a) | D.cs:356:13:356:13 | access to local variable a | Variable $@ may be null here because of $@ assignment. | D.cs:351:15:351:15 | a | a | D.cs:351:15:351:22 | Int32[] a = ... | this |
-| D.cs:363:13:363:16 | access to local variable last | D.cs:360:20:360:30 | SSA def(last) | D.cs:363:13:363:16 | access to local variable last | Variable $@ may be null here because of $@ assignment. | D.cs:360:20:360:23 | last | last | D.cs:360:20:360:30 | String last = ... | this |
-| D.cs:372:13:372:13 | access to local variable b | D.cs:366:15:366:47 | SSA def(b) | D.cs:372:13:372:13 | access to local variable b | Variable $@ may be null here because of $@ assignment. | D.cs:366:15:366:15 | b | b | D.cs:366:15:366:47 | Int32[] b = ... | this |
-| D.cs:395:20:395:20 | access to parameter a | D.cs:388:36:388:36 | SSA param(a) | D.cs:395:20:395:20 | access to parameter a | Variable $@ may be null here as suggested by $@ null check. | D.cs:388:36:388:36 | a | a | D.cs:390:20:390:28 | ... == ... | this |
-| D.cs:400:20:400:20 | access to parameter b | D.cs:388:45:388:45 | SSA param(b) | D.cs:400:20:400:20 | access to parameter b | Variable $@ may be null here as suggested by $@ null check. | D.cs:388:45:388:45 | b | b | D.cs:397:20:397:28 | ... == ... | this |
-| D.cs:410:13:410:13 | access to parameter y | D.cs:405:45:405:45 | SSA param(y) | D.cs:410:13:410:13 | access to parameter y | Variable $@ may be null here as suggested by $@ null check. | D.cs:405:45:405:45 | y | y | D.cs:407:27:407:35 | ... == ... | this |
-| D.cs:410:13:410:13 | access to parameter y | D.cs:405:45:405:45 | SSA param(y) | D.cs:410:13:410:13 | access to parameter y | Variable $@ may be null here as suggested by $@ null check. | D.cs:405:45:405:45 | y | y | D.cs:407:55:407:63 | ... != ... | this |
-| D.cs:410:13:410:13 | access to parameter y | D.cs:405:45:405:45 | SSA param(y) | D.cs:410:13:410:13 | access to parameter y | Variable $@ may be null here as suggested by $@ null check. | D.cs:405:45:405:45 | y | y | D.cs:411:13:411:21 | ... != ... | this |
-| D.cs:412:13:412:13 | access to parameter x | D.cs:405:35:405:35 | SSA param(x) | D.cs:412:13:412:13 | access to parameter x | Variable $@ may be null here as suggested by $@ null check. | D.cs:405:35:405:35 | x | x | D.cs:407:14:407:22 | ... != ... | this |
-| D.cs:412:13:412:13 | access to parameter x | D.cs:405:35:405:35 | SSA param(x) | D.cs:412:13:412:13 | access to parameter x | Variable $@ may be null here as suggested by $@ null check. | D.cs:405:35:405:35 | x | x | D.cs:407:42:407:50 | ... == ... | this |
-| D.cs:412:13:412:13 | access to parameter x | D.cs:405:35:405:35 | SSA param(x) | D.cs:412:13:412:13 | access to parameter x | Variable $@ may be null here as suggested by $@ null check. | D.cs:405:35:405:35 | x | x | D.cs:409:13:409:21 | ... != ... | this |
-| E.cs:12:38:12:39 | access to local variable a2 | E.cs:9:18:9:26 | SSA def(a2) | E.cs:12:38:12:39 | access to local variable a2 | Variable $@ may be null here because of $@ assignment. | E.cs:9:18:9:19 | a2 | a2 | E.cs:9:18:9:26 | Int64[][] a2 = ... | this |
-| E.cs:14:13:14:14 | access to local variable a3 | E.cs:11:16:11:24 | SSA def(a3) | E.cs:14:13:14:14 | access to local variable a3 | Variable $@ may be null here because of $@ assignment. | E.cs:11:16:11:17 | a3 | a3 | E.cs:11:16:11:24 | Int64[] a3 = ... | this |
-| E.cs:27:13:27:14 | access to local variable s1 | E.cs:23:13:23:30 | SSA def(s1) | E.cs:27:13:27:14 | access to local variable s1 | Variable $@ may be null here because of $@ assignment. | E.cs:19:13:19:14 | s1 | s1 | E.cs:23:13:23:30 | ... = ... | this |
-| E.cs:61:13:61:17 | access to local variable slice | E.cs:51:22:51:33 | SSA def(slice) | E.cs:61:13:61:17 | access to local variable slice | Variable $@ may be null here because of $@ assignment. | E.cs:51:22:51:26 | slice | slice | E.cs:51:22:51:33 | List slice = ... | this |
-| E.cs:73:13:73:15 | access to parameter arr | E.cs:66:40:66:42 | SSA param(arr) | E.cs:73:13:73:15 | access to parameter arr | Variable $@ may be null here as suggested by $@ null check. | E.cs:66:40:66:42 | arr | arr | E.cs:70:22:70:32 | ... == ... | this |
-| E.cs:112:13:112:16 | access to local variable arr2 | E.cs:107:15:107:25 | SSA def(arr2) | E.cs:112:13:112:16 | access to local variable arr2 | Variable $@ may be null here because of $@ assignment. | E.cs:107:15:107:18 | arr2 | arr2 | E.cs:107:15:107:25 | Int32[] arr2 = ... | this |
-| E.cs:125:33:125:35 | access to local variable obj | E.cs:137:25:137:34 | SSA def(obj) | E.cs:125:33:125:35 | access to local variable obj | Variable $@ may be null here because of $@ assignment. | E.cs:119:13:119:15 | obj | obj | E.cs:137:25:137:34 | ... = ... | this |
-| E.cs:159:13:159:16 | access to local variable obj2 | E.cs:152:16:152:26 | SSA def(obj2) | E.cs:159:13:159:16 | access to local variable obj2 | Variable $@ may be null here as suggested by $@ null check. | E.cs:152:16:152:19 | obj2 | obj2 | E.cs:153:13:153:24 | ... != ... | this |
-| E.cs:167:21:167:21 | access to parameter a | E.cs:162:28:162:28 | SSA param(a) | E.cs:167:21:167:21 | access to parameter a | Variable $@ may be null here as suggested by $@ null check. | E.cs:162:28:162:28 | a | a | E.cs:164:17:164:25 | ... == ... | this |
-| E.cs:178:13:178:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:178:13:178:15 | access to parameter obj | Variable $@ may be null here as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:175:19:175:29 | ... == ... | this |
-| E.cs:178:13:178:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:178:13:178:15 | access to parameter obj | Variable $@ may be null here as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:180:13:180:23 | ... == ... | this |
-| E.cs:186:13:186:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:186:13:186:15 | access to parameter obj | Variable $@ may be null here as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:175:19:175:29 | ... == ... | this |
-| E.cs:186:13:186:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:186:13:186:15 | access to parameter obj | Variable $@ may be null here as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:180:13:180:23 | ... == ... | this |
-| E.cs:192:17:192:17 | access to parameter o | E.cs:190:29:190:29 | SSA param(o) | E.cs:192:17:192:17 | access to parameter o | Variable $@ may be null here as suggested by $@ null check. | E.cs:190:29:190:29 | o | o | E.cs:193:17:193:17 | access to parameter o | this |
-| E.cs:201:13:201:13 | access to local variable o | E.cs:198:13:198:29 | [b (line 196): true] SSA def(o) | E.cs:201:13:201:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | E.cs:198:13:198:13 | o | o | E.cs:198:13:198:29 | String o = ... | this |
-| E.cs:203:13:203:13 | access to local variable o | E.cs:198:13:198:29 | [b (line 196): false] SSA def(o) | E.cs:203:13:203:13 | access to local variable o | Variable $@ may be null here because of $@ assignment. | E.cs:198:13:198:13 | o | o | E.cs:198:13:198:29 | String o = ... | this |
-| E.cs:218:9:218:9 | access to local variable x | E.cs:217:13:217:20 | [b (line 213): true] SSA def(x) | E.cs:218:9:218:9 | access to local variable x | Variable $@ may be null here because of $@ assignment. | E.cs:215:13:215:13 | x | x | E.cs:217:13:217:20 | ... = ... | this |
-| E.cs:230:9:230:9 | access to local variable x | E.cs:227:13:227:20 | [b (line 223): true] SSA def(x) | E.cs:230:9:230:9 | access to local variable x | Variable $@ may be null here because of $@ assignment. | E.cs:225:13:225:13 | x | x | E.cs:227:13:227:20 | ... = ... | this |
-| E.cs:235:16:235:16 | access to parameter i | E.cs:233:26:233:26 | SSA param(i) | E.cs:235:16:235:16 | access to parameter i | Variable $@ may be null here because it has a nullable type. | E.cs:233:26:233:26 | i | i | E.cs:233:26:233:26 | i | this |
-| E.cs:240:21:240:21 | access to parameter i | E.cs:238:26:238:26 | SSA param(i) | E.cs:240:21:240:21 | access to parameter i | Variable $@ may be null here because it has a nullable type. | E.cs:238:26:238:26 | i | i | E.cs:238:26:238:26 | i | this |
-| E.cs:285:9:285:9 | access to local variable o | E.cs:283:13:283:22 | [b (line 279): false] SSA def(o) | E.cs:285:9:285:9 | access to local variable o | Variable $@ may be null here as suggested by $@ null check. | E.cs:283:13:283:13 | o | o | E.cs:284:9:284:9 | access to local variable o | this |
-| E.cs:285:9:285:9 | access to local variable o | E.cs:283:13:283:22 | [b (line 279): true] SSA def(o) | E.cs:285:9:285:9 | access to local variable o | Variable $@ may be null here as suggested by $@ null check. | E.cs:283:13:283:13 | o | o | E.cs:284:9:284:9 | access to local variable o | this |
-| E.cs:302:9:302:9 | access to local variable s | E.cs:301:13:301:27 | SSA def(s) | E.cs:302:9:302:9 | access to local variable s | Variable $@ may be null here because of $@ assignment. | E.cs:301:13:301:13 | s | s | E.cs:301:13:301:27 | String s = ... | this |
-| E.cs:343:9:343:9 | access to local variable x | E.cs:342:13:342:32 | SSA def(x) | E.cs:343:9:343:9 | access to local variable x | Variable $@ may be null here because of $@ assignment. | E.cs:342:13:342:13 | x | x | E.cs:342:13:342:32 | String x = ... | this |
-| E.cs:349:9:349:9 | access to local variable x | E.cs:348:17:348:36 | SSA def(x) | E.cs:349:9:349:9 | access to local variable x | Variable $@ may be null here because of $@ assignment. | E.cs:348:17:348:17 | x | x | E.cs:348:17:348:36 | dynamic x = ... | this |
-| E.cs:366:41:366:41 | access to parameter s | E.cs:366:28:366:28 | SSA param(s) | E.cs:366:41:366:41 | access to parameter s | Variable $@ may be null here because the parameter has a null default value. | E.cs:366:28:366:28 | s | s | E.cs:366:32:366:35 | null | this |
-| E.cs:375:20:375:20 | access to local variable s | E.cs:374:17:374:31 | SSA def(s) | E.cs:375:20:375:20 | access to local variable s | Variable $@ may be null here because of $@ assignment. | E.cs:374:17:374:17 | s | s | E.cs:374:17:374:31 | String s = ... | this |
-| E.cs:386:16:386:17 | access to parameter e1 | E.cs:380:24:380:25 | SSA param(e1) | E.cs:386:16:386:17 | access to parameter e1 | Variable $@ may be null here as suggested by $@ null check. | E.cs:380:24:380:25 | e1 | e1 | E.cs:382:14:382:23 | ... == ... | this |
-| E.cs:386:16:386:17 | access to parameter e1 | E.cs:380:24:380:25 | SSA param(e1) | E.cs:386:16:386:17 | access to parameter e1 | Variable $@ may be null here as suggested by $@ null check. | E.cs:380:24:380:25 | e1 | e1 | E.cs:382:44:382:53 | ... != ... | this |
-| E.cs:386:16:386:17 | access to parameter e1 | E.cs:380:24:380:25 | SSA param(e1) | E.cs:386:16:386:17 | access to parameter e1 | Variable $@ may be null here as suggested by $@ null check. | E.cs:380:24:380:25 | e1 | e1 | E.cs:384:13:384:22 | ... == ... | this |
-| E.cs:386:27:386:28 | access to parameter e2 | E.cs:380:30:380:31 | SSA param(e2) | E.cs:386:27:386:28 | access to parameter e2 | Variable $@ may be null here as suggested by $@ null check. | E.cs:380:30:380:31 | e2 | e2 | E.cs:382:28:382:37 | ... != ... | this |
-| E.cs:386:27:386:28 | access to parameter e2 | E.cs:380:30:380:31 | SSA param(e2) | E.cs:386:27:386:28 | access to parameter e2 | Variable $@ may be null here as suggested by $@ null check. | E.cs:380:30:380:31 | e2 | e2 | E.cs:382:58:382:67 | ... == ... | this |
-| E.cs:386:27:386:28 | access to parameter e2 | E.cs:380:30:380:31 | SSA param(e2) | E.cs:386:27:386:28 | access to parameter e2 | Variable $@ may be null here as suggested by $@ null check. | E.cs:380:30:380:31 | e2 | e2 | E.cs:384:27:384:36 | ... == ... | this |
-| E.cs:417:34:417:34 | access to parameter i | E.cs:417:24:417:40 | SSA capture def(i) | E.cs:417:34:417:34 | access to parameter i | Variable $@ may be null here because it has a nullable type. | E.cs:415:27:415:27 | i | i | E.cs:415:27:415:27 | i | this |
-| GuardedString.cs:35:31:35:31 | access to local variable s | GuardedString.cs:7:16:7:32 | SSA def(s) | GuardedString.cs:35:31:35:31 | access to local variable s | Variable $@ may be null here because of $@ assignment. | GuardedString.cs:7:16:7:16 | s | s | GuardedString.cs:7:16:7:32 | String s = ... | this |
-| NullMaybeBad.cs:7:27:7:27 | access to parameter o | NullMaybeBad.cs:13:17:13:20 | null | NullMaybeBad.cs:7:27:7:27 | access to parameter o | Variable $@ may be null here because of $@ null argument. | NullMaybeBad.cs:5:25:5:25 | o | o | NullMaybeBad.cs:13:17:13:20 | null | this |
-| StringConcatenation.cs:16:17:16:17 | access to local variable s | StringConcatenation.cs:14:16:14:23 | SSA def(s) | StringConcatenation.cs:16:17:16:17 | access to local variable s | Variable $@ may be null here because of $@ assignment. | StringConcatenation.cs:14:16:14:16 | s | s | StringConcatenation.cs:14:16:14:23 | String s = ... | this |
+| C.cs:64:9:64:10 | access to local variable o1 | C.cs:62:13:62:46 | SSA def(o1) | C.cs:64:9:64:10 | access to local variable o1 | Variable $@ may be null at this access because of $@ assignment. | C.cs:62:13:62:14 | o1 | o1 | C.cs:62:13:62:46 | Object o1 = ... | this |
+| C.cs:68:9:68:10 | access to local variable o2 | C.cs:66:13:66:46 | SSA def(o2) | C.cs:68:9:68:10 | access to local variable o2 | Variable $@ may be null at this access because of $@ assignment. | C.cs:66:13:66:14 | o2 | o2 | C.cs:66:13:66:46 | Object o2 = ... | this |
+| C.cs:95:15:95:15 | access to local variable o | C.cs:94:13:94:45 | SSA def(o) | C.cs:95:15:95:15 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | C.cs:94:13:94:13 | o | o | C.cs:94:13:94:45 | Object o = ... | this |
+| C.cs:103:27:103:30 | access to parameter list | C.cs:102:13:102:23 | SSA def(list) | C.cs:103:27:103:30 | access to parameter list | Variable $@ may be null at this access because of $@ assignment. | C.cs:99:42:99:45 | list | list | C.cs:102:13:102:23 | ... = ... | this |
+| C.cs:177:13:177:13 | access to local variable s | C.cs:178:13:178:20 | SSA def(s) | C.cs:177:13:177:13 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | C.cs:151:13:151:13 | s | s | C.cs:178:13:178:20 | ... = ... | this |
+| C.cs:203:13:203:13 | access to local variable s | C.cs:204:13:204:20 | SSA def(s) | C.cs:203:13:203:13 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | C.cs:185:13:185:13 | s | s | C.cs:204:13:204:20 | ... = ... | this |
+| C.cs:223:9:223:9 | access to local variable s | C.cs:222:13:222:20 | SSA def(s) | C.cs:223:9:223:9 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | C.cs:210:13:210:13 | s | s | C.cs:222:13:222:20 | ... = ... | this |
+| C.cs:242:13:242:13 | access to local variable s | C.cs:240:24:240:31 | SSA def(s) | C.cs:242:13:242:13 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | C.cs:228:16:228:16 | s | s | C.cs:240:24:240:31 | ... = ... | this |
+| D.cs:23:9:23:13 | access to parameter param | D.cs:17:17:17:20 | null | D.cs:23:9:23:13 | access to parameter param | Variable $@ may be null at this access because of $@ null argument. | D.cs:21:32:21:36 | param | param | D.cs:17:17:17:20 | null | this |
+| D.cs:32:9:32:13 | access to parameter param | D.cs:26:32:26:36 | SSA param(param) | D.cs:32:9:32:13 | access to parameter param | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:26:32:26:36 | param | param | D.cs:28:13:28:25 | ... != ... | this |
+| D.cs:62:13:62:14 | access to local variable o5 | D.cs:58:13:58:41 | SSA def(o5) | D.cs:62:13:62:14 | access to local variable o5 | Variable $@ may be null at this access because of $@ assignment. | D.cs:58:13:58:14 | o5 | o5 | D.cs:58:13:58:41 | String o5 = ... | this |
+| D.cs:73:13:73:14 | access to local variable o7 | D.cs:68:13:68:34 | SSA def(o7) | D.cs:73:13:73:14 | access to local variable o7 | Variable $@ may be null at this access because of $@ assignment. | D.cs:68:13:68:14 | o7 | o7 | D.cs:68:13:68:34 | String o7 = ... | this |
+| D.cs:82:13:82:14 | access to local variable o8 | D.cs:75:13:75:34 | SSA def(o8) | D.cs:82:13:82:14 | access to local variable o8 | Variable $@ may be null at this access because of $@ assignment. | D.cs:75:13:75:14 | o8 | o8 | D.cs:75:13:75:34 | String o8 = ... | this |
+| D.cs:84:13:84:14 | access to local variable o8 | D.cs:75:13:75:34 | SSA def(o8) | D.cs:84:13:84:14 | access to local variable o8 | Variable $@ may be null at this access because of $@ assignment. | D.cs:75:13:75:14 | o8 | o8 | D.cs:75:13:75:34 | String o8 = ... | this |
+| D.cs:91:13:91:14 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:91:13:91:14 | access to local variable xs | Variable $@ may be null at this access because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
+| D.cs:94:21:94:22 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:94:21:94:22 | access to local variable xs | Variable $@ may be null at this access because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
+| D.cs:98:21:98:22 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:98:21:98:22 | access to local variable xs | Variable $@ may be null at this access because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
+| D.cs:102:31:102:32 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:102:31:102:32 | access to local variable xs | Variable $@ may be null at this access because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
+| D.cs:105:19:105:20 | access to local variable xs | D.cs:89:15:89:44 | SSA def(xs) | D.cs:105:19:105:20 | access to local variable xs | Variable $@ may be null at this access because of $@ assignment. | D.cs:89:15:89:16 | xs | xs | D.cs:89:15:89:44 | Int32[] xs = ... | this |
+| D.cs:134:24:134:24 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:134:24:134:24 | access to parameter a | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:127:20:127:28 | ... == ... | this |
+| D.cs:134:24:134:24 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:134:24:134:24 | access to parameter a | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:139:13:139:21 | ... != ... | this |
+| D.cs:135:24:135:24 | access to parameter b | D.cs:125:44:125:44 | SSA param(b) | D.cs:135:24:135:24 | access to parameter b | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:125:44:125:44 | b | b | D.cs:128:20:128:28 | ... == ... | this |
+| D.cs:145:20:145:20 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:145:20:145:20 | access to parameter a | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:127:20:127:28 | ... == ... | this |
+| D.cs:145:20:145:20 | access to parameter a | D.cs:125:35:125:35 | SSA param(a) | D.cs:145:20:145:20 | access to parameter a | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:125:35:125:35 | a | a | D.cs:139:13:139:21 | ... != ... | this |
+| D.cs:151:9:151:11 | access to parameter obj | D.cs:149:36:149:38 | SSA param(obj) | D.cs:151:9:151:11 | access to parameter obj | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:149:36:149:38 | obj | obj | D.cs:152:17:152:27 | ... != ... | this |
+| D.cs:171:9:171:11 | access to local variable obj | D.cs:163:16:163:25 | SSA def(obj) | D.cs:171:9:171:11 | access to local variable obj | Variable $@ may be null at this access because of $@ assignment. | D.cs:163:16:163:18 | obj | obj | D.cs:163:16:163:25 | Object obj = ... | this |
+| D.cs:245:13:245:13 | access to local variable o | D.cs:240:9:240:16 | SSA def(o) | D.cs:245:13:245:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:228:16:228:16 | o | o | D.cs:240:9:240:16 | ... = ... | this |
+| D.cs:247:13:247:13 | access to local variable o | D.cs:240:9:240:16 | SSA def(o) | D.cs:247:13:247:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:228:16:228:16 | o | o | D.cs:240:9:240:16 | ... = ... | this |
+| D.cs:253:13:253:14 | access to local variable o2 | D.cs:249:13:249:38 | SSA def(o2) | D.cs:253:13:253:14 | access to local variable o2 | Variable $@ may be null at this access because of $@ assignment. | D.cs:249:13:249:14 | o2 | o2 | D.cs:249:13:249:38 | String o2 = ... | this |
+| D.cs:267:13:267:13 | access to local variable o | D.cs:258:16:258:23 | SSA def(o) | D.cs:267:13:267:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:258:16:258:23 | Object o = ... | this |
+| D.cs:291:13:291:13 | access to local variable o | D.cs:269:9:269:16 | SSA def(o) | D.cs:291:13:291:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:269:9:269:16 | ... = ... | this |
+| D.cs:291:13:291:13 | access to local variable o | D.cs:283:17:283:24 | SSA def(o) | D.cs:291:13:291:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:283:17:283:24 | ... = ... | this |
+| D.cs:294:13:294:13 | access to local variable o | D.cs:269:9:269:16 | SSA def(o) | D.cs:294:13:294:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:269:9:269:16 | ... = ... | this |
+| D.cs:294:13:294:13 | access to local variable o | D.cs:283:17:283:24 | SSA def(o) | D.cs:294:13:294:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | D.cs:258:16:258:16 | o | o | D.cs:283:17:283:24 | ... = ... | this |
+| D.cs:300:17:300:20 | access to local variable prev | D.cs:296:16:296:26 | SSA def(prev) | D.cs:300:17:300:20 | access to local variable prev | Variable $@ may be null at this access because of $@ assignment. | D.cs:296:16:296:19 | prev | prev | D.cs:296:16:296:26 | Object prev = ... | this |
+| D.cs:313:17:313:17 | access to local variable s | D.cs:304:16:304:23 | SSA def(s) | D.cs:313:17:313:17 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | D.cs:304:16:304:16 | s | s | D.cs:304:16:304:23 | String s = ... | this |
+| D.cs:324:9:324:9 | access to local variable r | D.cs:316:16:316:23 | SSA def(r) | D.cs:324:9:324:9 | access to local variable r | Variable $@ may be null at this access because of $@ assignment. | D.cs:316:16:316:16 | r | r | D.cs:316:16:316:23 | Object r = ... | this |
+| D.cs:356:13:356:13 | access to local variable a | D.cs:351:15:351:22 | SSA def(a) | D.cs:356:13:356:13 | access to local variable a | Variable $@ may be null at this access because of $@ assignment. | D.cs:351:15:351:15 | a | a | D.cs:351:15:351:22 | Int32[] a = ... | this |
+| D.cs:363:13:363:16 | access to local variable last | D.cs:360:20:360:30 | SSA def(last) | D.cs:363:13:363:16 | access to local variable last | Variable $@ may be null at this access because of $@ assignment. | D.cs:360:20:360:23 | last | last | D.cs:360:20:360:30 | String last = ... | this |
+| D.cs:372:13:372:13 | access to local variable b | D.cs:366:15:366:47 | SSA def(b) | D.cs:372:13:372:13 | access to local variable b | Variable $@ may be null at this access because of $@ assignment. | D.cs:366:15:366:15 | b | b | D.cs:366:15:366:47 | Int32[] b = ... | this |
+| D.cs:395:20:395:20 | access to parameter a | D.cs:388:36:388:36 | SSA param(a) | D.cs:395:20:395:20 | access to parameter a | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:388:36:388:36 | a | a | D.cs:390:20:390:28 | ... == ... | this |
+| D.cs:400:20:400:20 | access to parameter b | D.cs:388:45:388:45 | SSA param(b) | D.cs:400:20:400:20 | access to parameter b | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:388:45:388:45 | b | b | D.cs:397:20:397:28 | ... == ... | this |
+| D.cs:410:13:410:13 | access to parameter y | D.cs:405:45:405:45 | SSA param(y) | D.cs:410:13:410:13 | access to parameter y | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:405:45:405:45 | y | y | D.cs:407:27:407:35 | ... == ... | this |
+| D.cs:410:13:410:13 | access to parameter y | D.cs:405:45:405:45 | SSA param(y) | D.cs:410:13:410:13 | access to parameter y | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:405:45:405:45 | y | y | D.cs:407:55:407:63 | ... != ... | this |
+| D.cs:410:13:410:13 | access to parameter y | D.cs:405:45:405:45 | SSA param(y) | D.cs:410:13:410:13 | access to parameter y | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:405:45:405:45 | y | y | D.cs:411:13:411:21 | ... != ... | this |
+| D.cs:412:13:412:13 | access to parameter x | D.cs:405:35:405:35 | SSA param(x) | D.cs:412:13:412:13 | access to parameter x | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:405:35:405:35 | x | x | D.cs:407:14:407:22 | ... != ... | this |
+| D.cs:412:13:412:13 | access to parameter x | D.cs:405:35:405:35 | SSA param(x) | D.cs:412:13:412:13 | access to parameter x | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:405:35:405:35 | x | x | D.cs:407:42:407:50 | ... == ... | this |
+| D.cs:412:13:412:13 | access to parameter x | D.cs:405:35:405:35 | SSA param(x) | D.cs:412:13:412:13 | access to parameter x | Variable $@ may be null at this access as suggested by $@ null check. | D.cs:405:35:405:35 | x | x | D.cs:409:13:409:21 | ... != ... | this |
+| E.cs:12:38:12:39 | access to local variable a2 | E.cs:9:18:9:26 | SSA def(a2) | E.cs:12:38:12:39 | access to local variable a2 | Variable $@ may be null at this access because of $@ assignment. | E.cs:9:18:9:19 | a2 | a2 | E.cs:9:18:9:26 | Int64[][] a2 = ... | this |
+| E.cs:14:13:14:14 | access to local variable a3 | E.cs:11:16:11:24 | SSA def(a3) | E.cs:14:13:14:14 | access to local variable a3 | Variable $@ may be null at this access because of $@ assignment. | E.cs:11:16:11:17 | a3 | a3 | E.cs:11:16:11:24 | Int64[] a3 = ... | this |
+| E.cs:27:13:27:14 | access to local variable s1 | E.cs:23:13:23:30 | SSA def(s1) | E.cs:27:13:27:14 | access to local variable s1 | Variable $@ may be null at this access because of $@ assignment. | E.cs:19:13:19:14 | s1 | s1 | E.cs:23:13:23:30 | ... = ... | this |
+| E.cs:61:13:61:17 | access to local variable slice | E.cs:51:22:51:33 | SSA def(slice) | E.cs:61:13:61:17 | access to local variable slice | Variable $@ may be null at this access because of $@ assignment. | E.cs:51:22:51:26 | slice | slice | E.cs:51:22:51:33 | List slice = ... | this |
+| E.cs:73:13:73:15 | access to parameter arr | E.cs:66:40:66:42 | SSA param(arr) | E.cs:73:13:73:15 | access to parameter arr | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:66:40:66:42 | arr | arr | E.cs:70:22:70:32 | ... == ... | this |
+| E.cs:112:13:112:16 | access to local variable arr2 | E.cs:107:15:107:25 | SSA def(arr2) | E.cs:112:13:112:16 | access to local variable arr2 | Variable $@ may be null at this access because of $@ assignment. | E.cs:107:15:107:18 | arr2 | arr2 | E.cs:107:15:107:25 | Int32[] arr2 = ... | this |
+| E.cs:125:33:125:35 | access to local variable obj | E.cs:137:25:137:34 | SSA def(obj) | E.cs:125:33:125:35 | access to local variable obj | Variable $@ may be null at this access because of $@ assignment. | E.cs:119:13:119:15 | obj | obj | E.cs:137:25:137:34 | ... = ... | this |
+| E.cs:159:13:159:16 | access to local variable obj2 | E.cs:152:16:152:26 | SSA def(obj2) | E.cs:159:13:159:16 | access to local variable obj2 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:152:16:152:19 | obj2 | obj2 | E.cs:153:13:153:24 | ... != ... | this |
+| E.cs:167:21:167:21 | access to parameter a | E.cs:162:28:162:28 | SSA param(a) | E.cs:167:21:167:21 | access to parameter a | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:162:28:162:28 | a | a | E.cs:164:17:164:25 | ... == ... | this |
+| E.cs:178:13:178:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:178:13:178:15 | access to parameter obj | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:175:19:175:29 | ... == ... | this |
+| E.cs:178:13:178:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:178:13:178:15 | access to parameter obj | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:180:13:180:23 | ... == ... | this |
+| E.cs:186:13:186:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:186:13:186:15 | access to parameter obj | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:175:19:175:29 | ... == ... | this |
+| E.cs:186:13:186:15 | access to parameter obj | E.cs:173:29:173:31 | SSA param(obj) | E.cs:186:13:186:15 | access to parameter obj | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:173:29:173:31 | obj | obj | E.cs:180:13:180:23 | ... == ... | this |
+| E.cs:192:17:192:17 | access to parameter o | E.cs:190:29:190:29 | SSA param(o) | E.cs:192:17:192:17 | access to parameter o | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:190:29:190:29 | o | o | E.cs:193:17:193:17 | access to parameter o | this |
+| E.cs:201:13:201:13 | access to local variable o | E.cs:198:13:198:29 | [b (line 196): true] SSA def(o) | E.cs:201:13:201:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | E.cs:198:13:198:13 | o | o | E.cs:198:13:198:29 | String o = ... | this |
+| E.cs:203:13:203:13 | access to local variable o | E.cs:198:13:198:29 | [b (line 196): false] SSA def(o) | E.cs:203:13:203:13 | access to local variable o | Variable $@ may be null at this access because of $@ assignment. | E.cs:198:13:198:13 | o | o | E.cs:198:13:198:29 | String o = ... | this |
+| E.cs:218:9:218:9 | access to local variable x | E.cs:217:13:217:20 | [b (line 213): true] SSA def(x) | E.cs:218:9:218:9 | access to local variable x | Variable $@ may be null at this access because of $@ assignment. | E.cs:215:13:215:13 | x | x | E.cs:217:13:217:20 | ... = ... | this |
+| E.cs:230:9:230:9 | access to local variable x | E.cs:227:13:227:20 | [b (line 223): true] SSA def(x) | E.cs:230:9:230:9 | access to local variable x | Variable $@ may be null at this access because of $@ assignment. | E.cs:225:13:225:13 | x | x | E.cs:227:13:227:20 | ... = ... | this |
+| E.cs:235:16:235:16 | access to parameter i | E.cs:233:26:233:26 | SSA param(i) | E.cs:235:16:235:16 | access to parameter i | Variable $@ may be null at this access because it has a nullable type. | E.cs:233:26:233:26 | i | i | E.cs:233:26:233:26 | i | this |
+| E.cs:240:21:240:21 | access to parameter i | E.cs:238:26:238:26 | SSA param(i) | E.cs:240:21:240:21 | access to parameter i | Variable $@ may be null at this access because it has a nullable type. | E.cs:238:26:238:26 | i | i | E.cs:238:26:238:26 | i | this |
+| E.cs:285:9:285:9 | access to local variable o | E.cs:283:13:283:22 | [b (line 279): false] SSA def(o) | E.cs:285:9:285:9 | access to local variable o | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:283:13:283:13 | o | o | E.cs:284:9:284:9 | access to local variable o | this |
+| E.cs:285:9:285:9 | access to local variable o | E.cs:283:13:283:22 | [b (line 279): true] SSA def(o) | E.cs:285:9:285:9 | access to local variable o | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:283:13:283:13 | o | o | E.cs:284:9:284:9 | access to local variable o | this |
+| E.cs:302:9:302:9 | access to local variable s | E.cs:301:13:301:27 | SSA def(s) | E.cs:302:9:302:9 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | E.cs:301:13:301:13 | s | s | E.cs:301:13:301:27 | String s = ... | this |
+| E.cs:343:9:343:9 | access to local variable x | E.cs:342:13:342:32 | SSA def(x) | E.cs:343:9:343:9 | access to local variable x | Variable $@ may be null at this access because of $@ assignment. | E.cs:342:13:342:13 | x | x | E.cs:342:13:342:32 | String x = ... | this |
+| E.cs:349:9:349:9 | access to local variable x | E.cs:348:17:348:36 | SSA def(x) | E.cs:349:9:349:9 | access to local variable x | Variable $@ may be null at this access because of $@ assignment. | E.cs:348:17:348:17 | x | x | E.cs:348:17:348:36 | dynamic x = ... | this |
+| E.cs:366:41:366:41 | access to parameter s | E.cs:366:28:366:28 | SSA param(s) | E.cs:366:41:366:41 | access to parameter s | Variable $@ may be null at this access because the parameter has a null default value. | E.cs:366:28:366:28 | s | s | E.cs:366:32:366:35 | null | this |
+| E.cs:375:20:375:20 | access to local variable s | E.cs:374:17:374:31 | SSA def(s) | E.cs:375:20:375:20 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | E.cs:374:17:374:17 | s | s | E.cs:374:17:374:31 | String s = ... | this |
+| E.cs:386:16:386:17 | access to parameter e1 | E.cs:380:24:380:25 | SSA param(e1) | E.cs:386:16:386:17 | access to parameter e1 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:380:24:380:25 | e1 | e1 | E.cs:382:14:382:23 | ... == ... | this |
+| E.cs:386:16:386:17 | access to parameter e1 | E.cs:380:24:380:25 | SSA param(e1) | E.cs:386:16:386:17 | access to parameter e1 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:380:24:380:25 | e1 | e1 | E.cs:382:44:382:53 | ... != ... | this |
+| E.cs:386:16:386:17 | access to parameter e1 | E.cs:380:24:380:25 | SSA param(e1) | E.cs:386:16:386:17 | access to parameter e1 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:380:24:380:25 | e1 | e1 | E.cs:384:13:384:22 | ... == ... | this |
+| E.cs:386:27:386:28 | access to parameter e2 | E.cs:380:30:380:31 | SSA param(e2) | E.cs:386:27:386:28 | access to parameter e2 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:380:30:380:31 | e2 | e2 | E.cs:382:28:382:37 | ... != ... | this |
+| E.cs:386:27:386:28 | access to parameter e2 | E.cs:380:30:380:31 | SSA param(e2) | E.cs:386:27:386:28 | access to parameter e2 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:380:30:380:31 | e2 | e2 | E.cs:382:58:382:67 | ... == ... | this |
+| E.cs:386:27:386:28 | access to parameter e2 | E.cs:380:30:380:31 | SSA param(e2) | E.cs:386:27:386:28 | access to parameter e2 | Variable $@ may be null at this access as suggested by $@ null check. | E.cs:380:30:380:31 | e2 | e2 | E.cs:384:27:384:36 | ... == ... | this |
+| E.cs:417:34:417:34 | access to parameter i | E.cs:417:24:417:40 | SSA capture def(i) | E.cs:417:34:417:34 | access to parameter i | Variable $@ may be null at this access because it has a nullable type. | E.cs:415:27:415:27 | i | i | E.cs:415:27:415:27 | i | this |
+| GuardedString.cs:35:31:35:31 | access to local variable s | GuardedString.cs:7:16:7:32 | SSA def(s) | GuardedString.cs:35:31:35:31 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | GuardedString.cs:7:16:7:16 | s | s | GuardedString.cs:7:16:7:32 | String s = ... | this |
+| NullMaybeBad.cs:7:27:7:27 | access to parameter o | NullMaybeBad.cs:13:17:13:20 | null | NullMaybeBad.cs:7:27:7:27 | access to parameter o | Variable $@ may be null at this access because of $@ null argument. | NullMaybeBad.cs:5:25:5:25 | o | o | NullMaybeBad.cs:13:17:13:20 | null | this |
+| StringConcatenation.cs:16:17:16:17 | access to local variable s | StringConcatenation.cs:14:16:14:23 | SSA def(s) | StringConcatenation.cs:16:17:16:17 | access to local variable s | Variable $@ may be null at this access because of $@ assignment. | StringConcatenation.cs:14:16:14:16 | s | s | StringConcatenation.cs:14:16:14:23 | String s = ... | this |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-022/TaintedPath/TaintedPath.expected b/csharp/ql/test/query-tests/Security Features/CWE-022/TaintedPath/TaintedPath.expected
index 59f27496610..77e55c484e7 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-022/TaintedPath/TaintedPath.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-022/TaintedPath/TaintedPath.expected
@@ -26,10 +26,10 @@ nodes
| TaintedPath.cs:51:26:51:29 | access to local variable path | semmle.label | access to local variable path |
subpaths
#select
-| TaintedPath.cs:12:50:12:53 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:12:50:12:53 | access to local variable path | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
-| TaintedPath.cs:17:51:17:54 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:17:51:17:54 | access to local variable path | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
-| TaintedPath.cs:25:30:25:33 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:25:30:25:33 | access to local variable path | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
-| TaintedPath.cs:31:30:31:33 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:31:30:31:33 | access to local variable path | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
-| TaintedPath.cs:36:25:36:31 | access to local variable badPath | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:36:25:36:31 | access to local variable badPath | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
-| TaintedPath.cs:38:49:38:55 | access to local variable badPath | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:38:49:38:55 | access to local variable badPath | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
-| TaintedPath.cs:51:26:51:29 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:51:26:51:29 | access to local variable path | $@ flows to here and is used in a path. | TaintedPath.cs:10:23:10:45 | access to property QueryString | User-provided value |
+| TaintedPath.cs:12:50:12:53 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:12:50:12:53 | access to local variable path | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
+| TaintedPath.cs:17:51:17:54 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:17:51:17:54 | access to local variable path | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
+| TaintedPath.cs:25:30:25:33 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:25:30:25:33 | access to local variable path | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
+| TaintedPath.cs:31:30:31:33 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:31:30:31:33 | access to local variable path | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
+| TaintedPath.cs:36:25:36:31 | access to local variable badPath | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:36:25:36:31 | access to local variable badPath | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
+| TaintedPath.cs:38:49:38:55 | access to local variable badPath | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:38:49:38:55 | access to local variable badPath | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
+| TaintedPath.cs:51:26:51:29 | access to local variable path | TaintedPath.cs:10:23:10:45 | access to property QueryString : NameValueCollection | TaintedPath.cs:51:26:51:29 | access to local variable path | This path depends on a $@. | TaintedPath.cs:10:23:10:45 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-078/CommandInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-078/CommandInjection.expected
index 06d2429450c..336342b9747 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-078/CommandInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-078/CommandInjection.expected
@@ -44,12 +44,12 @@ nodes
| CommandInjection.cs:35:27:35:40 | access to local variable startInfoProps | semmle.label | access to local variable startInfoProps |
subpaths
#select
-| CommandInjection.cs:26:27:26:47 | ... + ... | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:26:27:26:47 | ... + ... | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:26:50:26:66 | ... + ... | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:26:50:26:66 | ... + ... | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:28:63:28:71 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:28:63:28:71 | access to local variable userInput | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:28:74:28:82 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:28:74:28:82 | access to local variable userInput | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:29:27:29:35 | access to local variable startInfo | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:29:27:29:35 | access to local variable startInfo | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:32:39:32:47 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:32:39:32:47 | access to local variable userInput | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:33:40:33:48 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:33:40:33:48 | access to local variable userInput | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:34:47:34:55 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:34:47:34:55 | access to local variable userInput | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
-| CommandInjection.cs:35:27:35:40 | access to local variable startInfoProps | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:35:27:35:40 | access to local variable startInfoProps | $@ flows to here and is used in a command. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | User-provided value |
+| CommandInjection.cs:26:27:26:47 | ... + ... | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:26:27:26:47 | ... + ... | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:26:50:26:66 | ... + ... | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:26:50:26:66 | ... + ... | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:28:63:28:71 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:28:63:28:71 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:28:74:28:82 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:28:74:28:82 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:29:27:29:35 | access to local variable startInfo | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:29:27:29:35 | access to local variable startInfo | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:32:39:32:47 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:32:39:32:47 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:33:40:33:48 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:33:40:33:48 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:34:47:34:55 | access to local variable userInput | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:34:47:34:55 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
+| CommandInjection.cs:35:27:35:40 | access to local variable startInfoProps | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:35:27:35:40 | access to local variable startInfoProps | This command line depends on a $@. | CommandInjection.cs:25:32:25:46 | access to field categoryTextBox | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-078/StoredCommandInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-078/StoredCommandInjection.expected
index 2ea6dd3ad07..0c166565a83 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-078/StoredCommandInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-078/StoredCommandInjection.expected
@@ -5,4 +5,4 @@ nodes
| StoredCommandInjection.cs:22:54:22:80 | call to method GetString : String | semmle.label | call to method GetString : String |
subpaths
#select
-| StoredCommandInjection.cs:22:46:22:80 | ... + ... | StoredCommandInjection.cs:22:54:22:80 | call to method GetString : String | StoredCommandInjection.cs:22:46:22:80 | ... + ... | $@ flows to here and is used in a command. | StoredCommandInjection.cs:22:54:22:80 | call to method GetString | Stored user-provided value |
+| StoredCommandInjection.cs:22:46:22:80 | ... + ... | StoredCommandInjection.cs:22:54:22:80 | call to method GetString : String | StoredCommandInjection.cs:22:46:22:80 | ... + ... | This command line depends on a $@. | StoredCommandInjection.cs:22:54:22:80 | call to method GetString | stored (potentially user-provided) value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/StoredXSS.expected b/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/StoredXSS.expected
index 4f3aaa0356e..bafe7257095 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/StoredXSS.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/StoredXSS.expected
@@ -5,4 +5,4 @@ nodes
| StoredXSS.cs:24:60:24:86 | call to method GetString : String | semmle.label | call to method GetString : String |
subpaths
#select
-| StoredXSS.cs:24:44:24:86 | ... + ... | StoredXSS.cs:24:60:24:86 | call to method GetString : String | StoredXSS.cs:24:44:24:86 | ... + ... | $@ flows to here and is written to HTML or JavaScript. | StoredXSS.cs:24:60:24:86 | call to method GetString | Stored user-provided value |
+| StoredXSS.cs:24:44:24:86 | ... + ... | StoredXSS.cs:24:60:24:86 | call to method GetString : String | StoredXSS.cs:24:44:24:86 | ... + ... | This HTML or JavaScript write depends on a $@. | StoredXSS.cs:24:60:24:86 | call to method GetString | stored (potentially user-provided) value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-089/SecondOrderSqlInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-089/SecondOrderSqlInjection.expected
index b283c6b7f70..e6048fc656e 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-089/SecondOrderSqlInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-089/SecondOrderSqlInjection.expected
@@ -35,6 +35,6 @@ nodes
| SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | semmle.label | access to local variable sql |
subpaths
#select
-| SecondOrderSqlInjection.cs:25:71:25:145 | ... + ... | SecondOrderSqlInjection.cs:25:119:25:145 | call to method GetString : String | SecondOrderSqlInjection.cs:25:71:25:145 | ... + ... | $@ flows to here and is used in an SQL query. | SecondOrderSqlInjection.cs:25:119:25:145 | call to method GetString | Stored user-provided value |
-| SecondOrderSqlInjection.cs:45:57:45:59 | access to local variable sql | SecondOrderSqlInjection.cs:33:36:33:78 | object creation of type FileStream : FileStream | SecondOrderSqlInjection.cs:45:57:45:59 | access to local variable sql | $@ flows to here and is used in an SQL query. | SecondOrderSqlInjection.cs:33:36:33:78 | object creation of type FileStream | Stored user-provided value |
-| SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | SqlInjectionSqlite.cs:49:36:49:84 | object creation of type FileStream : FileStream | SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | $@ flows to here and is used in an SQL query. | SqlInjectionSqlite.cs:49:36:49:84 | object creation of type FileStream | Stored user-provided value |
+| SecondOrderSqlInjection.cs:25:71:25:145 | ... + ... | SecondOrderSqlInjection.cs:25:119:25:145 | call to method GetString : String | SecondOrderSqlInjection.cs:25:71:25:145 | ... + ... | This SQL query depends on a $@. | SecondOrderSqlInjection.cs:25:119:25:145 | call to method GetString | stored user-provided value |
+| SecondOrderSqlInjection.cs:45:57:45:59 | access to local variable sql | SecondOrderSqlInjection.cs:33:36:33:78 | object creation of type FileStream : FileStream | SecondOrderSqlInjection.cs:45:57:45:59 | access to local variable sql | This SQL query depends on a $@. | SecondOrderSqlInjection.cs:33:36:33:78 | object creation of type FileStream | stored user-provided value |
+| SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | SqlInjectionSqlite.cs:49:36:49:84 | object creation of type FileStream : FileStream | SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | This SQL query depends on a $@. | SqlInjectionSqlite.cs:49:36:49:84 | object creation of type FileStream | stored user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-089/SqlInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-089/SqlInjection.expected
index f42ab5fb795..888573d86b6 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-089/SqlInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-089/SqlInjection.expected
@@ -84,22 +84,22 @@ nodes
| SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | semmle.label | access to local variable sql |
subpaths
#select
-| SqlInjection.cs:34:50:34:55 | access to local variable query1 | SqlInjection.cs:33:21:33:35 | access to field categoryTextBox : TextBox | SqlInjection.cs:34:50:34:55 | access to local variable query1 | Query might include code from $@. | SqlInjection.cs:33:21:33:35 | access to field categoryTextBox : TextBox | this ASP.NET user input |
-| SqlInjection.cs:69:56:69:61 | access to local variable query1 | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | SqlInjection.cs:69:56:69:61 | access to local variable query1 | Query might include code from $@. | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | this ASP.NET user input |
-| SqlInjection.cs:70:55:70:60 | access to local variable query1 | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | SqlInjection.cs:70:55:70:60 | access to local variable query1 | Query might include code from $@. | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | this ASP.NET user input |
-| SqlInjection.cs:83:50:83:55 | access to local variable query1 | SqlInjection.cs:82:21:82:29 | access to property Text : String | SqlInjection.cs:83:50:83:55 | access to local variable query1 | Query might include code from $@. | SqlInjection.cs:82:21:82:29 | access to property Text : String | this TextBox text |
-| SqlInjection.cs:93:42:93:52 | access to local variable queryString | SqlInjection.cs:92:21:92:29 | access to property Text : String | SqlInjection.cs:93:42:93:52 | access to local variable queryString | Query might include code from $@. | SqlInjection.cs:92:21:92:29 | access to property Text : String | this TextBox text |
-| SqlInjection.cs:94:50:94:52 | access to local variable cmd | SqlInjection.cs:92:21:92:29 | access to property Text : String | SqlInjection.cs:94:50:94:52 | access to local variable cmd | Query might include code from $@. | SqlInjection.cs:92:21:92:29 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:21:55:21:59 | access to local variable query | SqlInjectionDapper.cs:20:86:20:94 | access to property Text : String | SqlInjectionDapper.cs:21:55:21:59 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:20:86:20:94 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:30:66:30:70 | access to local variable query | SqlInjectionDapper.cs:29:86:29:94 | access to property Text : String | SqlInjectionDapper.cs:30:66:30:70 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:29:86:29:94 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:39:63:39:67 | access to local variable query | SqlInjectionDapper.cs:38:86:38:94 | access to property Text : String | SqlInjectionDapper.cs:39:63:39:67 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:38:86:38:94 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:49:47:49:51 | access to local variable query | SqlInjectionDapper.cs:47:86:47:94 | access to property Text : String | SqlInjectionDapper.cs:49:47:49:51 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:47:86:47:94 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:58:42:58:46 | access to local variable query | SqlInjectionDapper.cs:57:86:57:94 | access to property Text : String | SqlInjectionDapper.cs:58:42:58:46 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:57:86:57:94 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:67:42:67:46 | access to local variable query | SqlInjectionDapper.cs:66:86:66:94 | access to property Text : String | SqlInjectionDapper.cs:67:42:67:46 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:66:86:66:94 | access to property Text : String | this TextBox text |
-| SqlInjectionDapper.cs:77:52:77:56 | access to local variable query | SqlInjectionDapper.cs:75:86:75:94 | access to property Text : String | SqlInjectionDapper.cs:77:52:77:56 | access to local variable query | Query might include code from $@. | SqlInjectionDapper.cs:75:86:75:94 | access to property Text : String | this TextBox text |
-| SqlInjectionSqlite.cs:19:51:19:68 | access to property Text | SqlInjectionSqlite.cs:19:51:19:63 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:19:51:19:68 | access to property Text | Query might include code from $@. | SqlInjectionSqlite.cs:19:51:19:63 | access to field untrustedData : TextBox | this ASP.NET user input |
-| SqlInjectionSqlite.cs:24:41:24:58 | access to property Text | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:24:41:24:58 | access to property Text | Query might include code from $@. | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | this ASP.NET user input |
-| SqlInjectionSqlite.cs:33:49:33:66 | access to property Text | SqlInjectionSqlite.cs:33:49:33:61 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:33:49:33:66 | access to property Text | Query might include code from $@. | SqlInjectionSqlite.cs:33:49:33:61 | access to field untrustedData : TextBox | this ASP.NET user input |
-| SqlInjectionSqlite.cs:39:45:39:62 | access to property Text | SqlInjectionSqlite.cs:39:45:39:57 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:39:45:39:62 | access to property Text | Query might include code from $@. | SqlInjectionSqlite.cs:39:45:39:57 | access to field untrustedData : TextBox | this ASP.NET user input |
-| SqlInjectionSqlite.cs:44:45:44:47 | access to local variable cmd | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:44:45:44:47 | access to local variable cmd | Query might include code from $@. | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | this ASP.NET user input |
-| SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | SqlInjectionSqlite.cs:49:51:49:63 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | Query might include code from $@. | SqlInjectionSqlite.cs:49:51:49:63 | access to field untrustedData : TextBox | this ASP.NET user input |
+| SqlInjection.cs:34:50:34:55 | access to local variable query1 | SqlInjection.cs:33:21:33:35 | access to field categoryTextBox : TextBox | SqlInjection.cs:34:50:34:55 | access to local variable query1 | This query depends on $@. | SqlInjection.cs:33:21:33:35 | access to field categoryTextBox : TextBox | this ASP.NET user input |
+| SqlInjection.cs:69:56:69:61 | access to local variable query1 | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | SqlInjection.cs:69:56:69:61 | access to local variable query1 | This query depends on $@. | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | this ASP.NET user input |
+| SqlInjection.cs:70:55:70:60 | access to local variable query1 | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | SqlInjection.cs:70:55:70:60 | access to local variable query1 | This query depends on $@. | SqlInjection.cs:68:33:68:47 | access to field categoryTextBox : TextBox | this ASP.NET user input |
+| SqlInjection.cs:83:50:83:55 | access to local variable query1 | SqlInjection.cs:82:21:82:29 | access to property Text : String | SqlInjection.cs:83:50:83:55 | access to local variable query1 | This query depends on $@. | SqlInjection.cs:82:21:82:29 | access to property Text : String | this TextBox text |
+| SqlInjection.cs:93:42:93:52 | access to local variable queryString | SqlInjection.cs:92:21:92:29 | access to property Text : String | SqlInjection.cs:93:42:93:52 | access to local variable queryString | This query depends on $@. | SqlInjection.cs:92:21:92:29 | access to property Text : String | this TextBox text |
+| SqlInjection.cs:94:50:94:52 | access to local variable cmd | SqlInjection.cs:92:21:92:29 | access to property Text : String | SqlInjection.cs:94:50:94:52 | access to local variable cmd | This query depends on $@. | SqlInjection.cs:92:21:92:29 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:21:55:21:59 | access to local variable query | SqlInjectionDapper.cs:20:86:20:94 | access to property Text : String | SqlInjectionDapper.cs:21:55:21:59 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:20:86:20:94 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:30:66:30:70 | access to local variable query | SqlInjectionDapper.cs:29:86:29:94 | access to property Text : String | SqlInjectionDapper.cs:30:66:30:70 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:29:86:29:94 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:39:63:39:67 | access to local variable query | SqlInjectionDapper.cs:38:86:38:94 | access to property Text : String | SqlInjectionDapper.cs:39:63:39:67 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:38:86:38:94 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:49:47:49:51 | access to local variable query | SqlInjectionDapper.cs:47:86:47:94 | access to property Text : String | SqlInjectionDapper.cs:49:47:49:51 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:47:86:47:94 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:58:42:58:46 | access to local variable query | SqlInjectionDapper.cs:57:86:57:94 | access to property Text : String | SqlInjectionDapper.cs:58:42:58:46 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:57:86:57:94 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:67:42:67:46 | access to local variable query | SqlInjectionDapper.cs:66:86:66:94 | access to property Text : String | SqlInjectionDapper.cs:67:42:67:46 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:66:86:66:94 | access to property Text : String | this TextBox text |
+| SqlInjectionDapper.cs:77:52:77:56 | access to local variable query | SqlInjectionDapper.cs:75:86:75:94 | access to property Text : String | SqlInjectionDapper.cs:77:52:77:56 | access to local variable query | This query depends on $@. | SqlInjectionDapper.cs:75:86:75:94 | access to property Text : String | this TextBox text |
+| SqlInjectionSqlite.cs:19:51:19:68 | access to property Text | SqlInjectionSqlite.cs:19:51:19:63 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:19:51:19:68 | access to property Text | This query depends on $@. | SqlInjectionSqlite.cs:19:51:19:63 | access to field untrustedData : TextBox | this ASP.NET user input |
+| SqlInjectionSqlite.cs:24:41:24:58 | access to property Text | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:24:41:24:58 | access to property Text | This query depends on $@. | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | this ASP.NET user input |
+| SqlInjectionSqlite.cs:33:49:33:66 | access to property Text | SqlInjectionSqlite.cs:33:49:33:61 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:33:49:33:66 | access to property Text | This query depends on $@. | SqlInjectionSqlite.cs:33:49:33:61 | access to field untrustedData : TextBox | this ASP.NET user input |
+| SqlInjectionSqlite.cs:39:45:39:62 | access to property Text | SqlInjectionSqlite.cs:39:45:39:57 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:39:45:39:62 | access to property Text | This query depends on $@. | SqlInjectionSqlite.cs:39:45:39:57 | access to field untrustedData : TextBox | this ASP.NET user input |
+| SqlInjectionSqlite.cs:44:45:44:47 | access to local variable cmd | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:44:45:44:47 | access to local variable cmd | This query depends on $@. | SqlInjectionSqlite.cs:24:41:24:53 | access to field untrustedData : TextBox | this ASP.NET user input |
+| SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | SqlInjectionSqlite.cs:49:51:49:63 | access to field untrustedData : TextBox | SqlInjectionSqlite.cs:61:53:61:55 | access to local variable sql | This query depends on $@. | SqlInjectionSqlite.cs:49:51:49:63 | access to field untrustedData : TextBox | this ASP.NET user input |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-090/LDAPInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-090/LDAPInjection.expected
index b0fd2471366..0699a17d531 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-090/LDAPInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-090/LDAPInjection.expected
@@ -23,9 +23,9 @@ nodes
| LDAPInjection.cs:29:20:29:42 | ... + ... | semmle.label | ... + ... |
subpaths
#select
-| LDAPInjection.cs:14:54:14:78 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:14:54:14:78 | ... + ... | $@ flows to here and is used in an LDAP query. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| LDAPInjection.cs:16:21:16:45 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:16:21:16:45 | ... + ... | $@ flows to here and is used in an LDAP query. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| LDAPInjection.cs:23:21:23:45 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:23:21:23:45 | ... + ... | $@ flows to here and is used in an LDAP query. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| LDAPInjection.cs:24:53:24:77 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:24:53:24:77 | ... + ... | $@ flows to here and is used in an LDAP query. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| LDAPInjection.cs:27:48:27:70 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:27:48:27:70 | ... + ... | $@ flows to here and is used in an LDAP query. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| LDAPInjection.cs:29:20:29:42 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:29:20:29:42 | ... + ... | $@ flows to here and is used in an LDAP query. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
+| LDAPInjection.cs:14:54:14:78 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:14:54:14:78 | ... + ... | This LDAP query depends on a $@. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| LDAPInjection.cs:16:21:16:45 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:16:21:16:45 | ... + ... | This LDAP query depends on a $@. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| LDAPInjection.cs:23:21:23:45 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:23:21:23:45 | ... + ... | This LDAP query depends on a $@. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| LDAPInjection.cs:24:53:24:77 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:24:53:24:77 | ... + ... | This LDAP query depends on a $@. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| LDAPInjection.cs:27:48:27:70 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:27:48:27:70 | ... + ... | This LDAP query depends on a $@. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| LDAPInjection.cs:29:20:29:42 | ... + ... | LDAPInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | LDAPInjection.cs:29:20:29:42 | ... + ... | This LDAP query depends on a $@. | LDAPInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-090/StoredLDAPInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-090/StoredLDAPInjection.expected
index 0d51f35df60..34e5ef3dc99 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-090/StoredLDAPInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-090/StoredLDAPInjection.expected
@@ -5,4 +5,4 @@ nodes
| StoredLDAPInjection.cs:22:83:22:109 | call to method GetString : String | semmle.label | call to method GetString : String |
subpaths
#select
-| StoredLDAPInjection.cs:22:66:22:109 | ... + ... | StoredLDAPInjection.cs:22:83:22:109 | call to method GetString : String | StoredLDAPInjection.cs:22:66:22:109 | ... + ... | $@ flows to here and is used in an LDAP query. | StoredLDAPInjection.cs:22:83:22:109 | call to method GetString | Stored user-provided value |
+| StoredLDAPInjection.cs:22:66:22:109 | ... + ... | StoredLDAPInjection.cs:22:83:22:109 | call to method GetString : String | StoredLDAPInjection.cs:22:66:22:109 | ... + ... | This LDAP query depends on a $@. | StoredLDAPInjection.cs:22:83:22:109 | call to method GetString | stored (potentially user-provided) value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-091/XMLInjection/XMLInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-091/XMLInjection/XMLInjection.expected
index e3faaba88be..63b1d336449 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-091/XMLInjection/XMLInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-091/XMLInjection/XMLInjection.expected
@@ -8,4 +8,4 @@ nodes
| Test.cs:15:25:15:80 | ... + ... | semmle.label | ... + ... |
subpaths
#select
-| Test.cs:15:25:15:80 | ... + ... | Test.cs:8:27:8:49 | access to property QueryString : NameValueCollection | Test.cs:15:25:15:80 | ... + ... | $@ flows to here and is inserted as XML. | Test.cs:8:27:8:49 | access to property QueryString : NameValueCollection | User-provided value |
+| Test.cs:15:25:15:80 | ... + ... | Test.cs:8:27:8:49 | access to property QueryString : NameValueCollection | Test.cs:15:25:15:80 | ... + ... | This XML element depends on a $@. | Test.cs:8:27:8:49 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-094/CodeInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-094/CodeInjection.expected
index 97cbabb543d..006ca27fdd7 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-094/CodeInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-094/CodeInjection.expected
@@ -12,6 +12,6 @@ nodes
| CodeInjection.cs:56:36:56:44 | access to property Text | semmle.label | access to property Text |
subpaths
#select
-| CodeInjection.cs:29:64:29:67 | access to local variable code | CodeInjection.cs:23:23:23:45 | access to property QueryString : NameValueCollection | CodeInjection.cs:29:64:29:67 | access to local variable code | $@ flows to here and is compiled as code. | CodeInjection.cs:23:23:23:45 | access to property QueryString | User-provided value |
-| CodeInjection.cs:40:36:40:39 | access to local variable code | CodeInjection.cs:23:23:23:45 | access to property QueryString : NameValueCollection | CodeInjection.cs:40:36:40:39 | access to local variable code | $@ flows to here and is compiled as code. | CodeInjection.cs:23:23:23:45 | access to property QueryString | User-provided value |
-| CodeInjection.cs:56:36:56:44 | access to property Text | CodeInjection.cs:56:36:56:44 | access to property Text | CodeInjection.cs:56:36:56:44 | access to property Text | $@ flows to here and is compiled as code. | CodeInjection.cs:56:36:56:44 | access to property Text | User-provided value |
+| CodeInjection.cs:29:64:29:67 | access to local variable code | CodeInjection.cs:23:23:23:45 | access to property QueryString : NameValueCollection | CodeInjection.cs:29:64:29:67 | access to local variable code | This code compilation depends on a $@. | CodeInjection.cs:23:23:23:45 | access to property QueryString | user-provided value |
+| CodeInjection.cs:40:36:40:39 | access to local variable code | CodeInjection.cs:23:23:23:45 | access to property QueryString : NameValueCollection | CodeInjection.cs:40:36:40:39 | access to local variable code | This code compilation depends on a $@. | CodeInjection.cs:23:23:23:45 | access to property QueryString | user-provided value |
+| CodeInjection.cs:56:36:56:44 | access to property Text | CodeInjection.cs:56:36:56:44 | access to property Text | CodeInjection.cs:56:36:56:44 | access to property Text | This code compilation depends on a $@. | CodeInjection.cs:56:36:56:44 | access to property Text | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-099/ResourceInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-099/ResourceInjection.expected
index 8cd9b0955df..75ef7285557 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-099/ResourceInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-099/ResourceInjection.expected
@@ -11,5 +11,5 @@ nodes
| ResourceInjection.cs:13:42:13:57 | access to local variable connectionString | semmle.label | access to local variable connectionString |
subpaths
#select
-| ResourceInjection.cs:11:57:11:72 | access to local variable connectionString | ResourceInjection.cs:8:27:8:49 | access to property QueryString : NameValueCollection | ResourceInjection.cs:11:57:11:72 | access to local variable connectionString | $@ flows to here and is used in a resource descriptor. | ResourceInjection.cs:8:27:8:49 | access to property QueryString | User-provided value |
-| ResourceInjection.cs:13:42:13:57 | access to local variable connectionString | ResourceInjection.cs:8:27:8:49 | access to property QueryString : NameValueCollection | ResourceInjection.cs:13:42:13:57 | access to local variable connectionString | $@ flows to here and is used in a resource descriptor. | ResourceInjection.cs:8:27:8:49 | access to property QueryString | User-provided value |
+| ResourceInjection.cs:11:57:11:72 | access to local variable connectionString | ResourceInjection.cs:8:27:8:49 | access to property QueryString : NameValueCollection | ResourceInjection.cs:11:57:11:72 | access to local variable connectionString | This resource descriptor depends on a $@. | ResourceInjection.cs:8:27:8:49 | access to property QueryString | user-provided value |
+| ResourceInjection.cs:13:42:13:57 | access to local variable connectionString | ResourceInjection.cs:8:27:8:49 | access to property QueryString : NameValueCollection | ResourceInjection.cs:13:42:13:57 | access to local variable connectionString | This resource descriptor depends on a $@. | ResourceInjection.cs:8:27:8:49 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-112/MissingXMLValidation.expected b/csharp/ql/test/query-tests/Security Features/CWE-112/MissingXMLValidation.expected
index a8d1ebb8202..869daaa60cb 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-112/MissingXMLValidation.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-112/MissingXMLValidation.expected
@@ -30,8 +30,8 @@ nodes
| MissingXMLValidation.cs:45:43:45:57 | access to local variable userProvidedXml : String | semmle.label | access to local variable userProvidedXml : String |
subpaths
#select
-| MissingXMLValidation.cs:16:26:16:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:16:26:16:58 | object creation of type StringReader | $@ flows to here and is processed as XML without validation because there is no 'XmlReaderSettings' instance specifying schema validation. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | User-provided value |
-| MissingXMLValidation.cs:21:26:21:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:21:26:21:58 | object creation of type StringReader | $@ flows to here and is processed as XML without validation because the 'XmlReaderSettings' instance does not specify the 'ValidationType' as 'Schema'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | User-provided value |
-| MissingXMLValidation.cs:27:26:27:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:27:26:27:58 | object creation of type StringReader | $@ flows to here and is processed as XML without validation because the 'XmlReaderSettings' instance does not specify the 'ValidationType' as 'Schema'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | User-provided value |
-| MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | $@ flows to here and is processed as XML without validation because the 'XmlReaderSettings' instance specifies 'ProcessInlineSchema'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | User-provided value |
-| MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | $@ flows to here and is processed as XML without validation because the 'XmlReaderSettings' instance specifies 'ProcessSchemaLocation'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | User-provided value |
+| MissingXMLValidation.cs:16:26:16:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:16:26:16:58 | object creation of type StringReader | This XML processing depends on a $@ without validation because there is no 'XmlReaderSettings' instance specifying schema validation. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | user-provided value |
+| MissingXMLValidation.cs:21:26:21:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:21:26:21:58 | object creation of type StringReader | This XML processing depends on a $@ without validation because the 'XmlReaderSettings' instance does not specify the 'ValidationType' as 'Schema'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | user-provided value |
+| MissingXMLValidation.cs:27:26:27:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:27:26:27:58 | object creation of type StringReader | This XML processing depends on a $@ without validation because the 'XmlReaderSettings' instance does not specify the 'ValidationType' as 'Schema'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | user-provided value |
+| MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | This XML processing depends on a $@ without validation because the 'XmlReaderSettings' instance specifies 'ProcessInlineSchema'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | user-provided value |
+| MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString : NameValueCollection | MissingXMLValidation.cs:45:26:45:58 | object creation of type StringReader | This XML processing depends on a $@ without validation because the 'XmlReaderSettings' instance specifies 'ProcessSchemaLocation'. | MissingXMLValidation.cs:12:34:12:56 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-114/AssemblyPathInjection/AssemblyPathInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-114/AssemblyPathInjection/AssemblyPathInjection.expected
index 8c25b53570c..2f3c3bbb4a6 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-114/AssemblyPathInjection/AssemblyPathInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-114/AssemblyPathInjection/AssemblyPathInjection.expected
@@ -1 +1 @@
-| Test.cs:10:36:10:46 | access to local variable libraryName | $@ flows to here and is used as the path to dynamically load an assembly. | Test.cs:7:26:7:48 | access to property QueryString | User-provided value |
+| Test.cs:10:36:10:46 | access to local variable libraryName | This assembly path depends on a $@. | Test.cs:7:26:7:48 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-117/LogForging.expected b/csharp/ql/test/query-tests/Security Features/CWE-117/LogForging.expected
index 6dca2870db3..cfae0ac589e 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-117/LogForging.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-117/LogForging.expected
@@ -14,6 +14,6 @@ nodes
| LogForgingAsp.cs:12:21:12:43 | ... + ... | semmle.label | ... + ... |
subpaths
#select
-| LogForging.cs:20:21:20:43 | ... + ... | LogForging.cs:17:27:17:49 | access to property QueryString : NameValueCollection | LogForging.cs:20:21:20:43 | ... + ... | $@ flows to log entry. | LogForging.cs:17:27:17:49 | access to property QueryString | User-provided value |
-| LogForging.cs:26:50:26:72 | ... + ... | LogForging.cs:17:27:17:49 | access to property QueryString : NameValueCollection | LogForging.cs:26:50:26:72 | ... + ... | $@ flows to log entry. | LogForging.cs:17:27:17:49 | access to property QueryString | User-provided value |
-| LogForgingAsp.cs:12:21:12:43 | ... + ... | LogForgingAsp.cs:8:32:8:39 | username : String | LogForgingAsp.cs:12:21:12:43 | ... + ... | $@ flows to log entry. | LogForgingAsp.cs:8:32:8:39 | username | User-provided value |
+| LogForging.cs:20:21:20:43 | ... + ... | LogForging.cs:17:27:17:49 | access to property QueryString : NameValueCollection | LogForging.cs:20:21:20:43 | ... + ... | This log entry depends on a $@. | LogForging.cs:17:27:17:49 | access to property QueryString | user-provided value |
+| LogForging.cs:26:50:26:72 | ... + ... | LogForging.cs:17:27:17:49 | access to property QueryString : NameValueCollection | LogForging.cs:26:50:26:72 | ... + ... | This log entry depends on a $@. | LogForging.cs:17:27:17:49 | access to property QueryString | user-provided value |
+| LogForgingAsp.cs:12:21:12:43 | ... + ... | LogForgingAsp.cs:8:32:8:39 | username : String | LogForgingAsp.cs:12:21:12:43 | ... + ... | This log entry depends on a $@. | LogForgingAsp.cs:8:32:8:39 | username | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-134/UncontrolledFormatString.expected b/csharp/ql/test/query-tests/Security Features/CWE-134/UncontrolledFormatString.expected
index 2aa7b13890b..5945b83d635 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-134/UncontrolledFormatString.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-134/UncontrolledFormatString.expected
@@ -21,8 +21,8 @@ nodes
| UncontrolledFormatStringBad.cs:12:39:12:44 | access to local variable format | semmle.label | access to local variable format |
subpaths
#select
-| ConsoleUncontrolledFormatString.cs:11:31:11:36 | access to local variable format | ConsoleUncontrolledFormatString.cs:8:22:8:39 | call to method ReadLine : String | ConsoleUncontrolledFormatString.cs:11:31:11:36 | access to local variable format | $@ flows to here and is used as a format string. | ConsoleUncontrolledFormatString.cs:8:22:8:39 | call to method ReadLine | call to method ReadLine |
-| UncontrolledFormatString.cs:12:23:12:26 | access to local variable path | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString : NameValueCollection | UncontrolledFormatString.cs:12:23:12:26 | access to local variable path | $@ flows to here and is used as a format string. | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString | access to property QueryString |
-| UncontrolledFormatString.cs:15:46:15:49 | access to local variable path | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString : NameValueCollection | UncontrolledFormatString.cs:15:46:15:49 | access to local variable path | $@ flows to here and is used as a format string. | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString | access to property QueryString |
-| UncontrolledFormatString.cs:32:23:32:31 | access to property Text | UncontrolledFormatString.cs:32:23:32:31 | access to property Text | UncontrolledFormatString.cs:32:23:32:31 | access to property Text | $@ flows to here and is used as a format string. | UncontrolledFormatString.cs:32:23:32:31 | access to property Text | access to property Text |
-| UncontrolledFormatStringBad.cs:12:39:12:44 | access to local variable format | UncontrolledFormatStringBad.cs:9:25:9:47 | access to property QueryString : NameValueCollection | UncontrolledFormatStringBad.cs:12:39:12:44 | access to local variable format | $@ flows to here and is used as a format string. | UncontrolledFormatStringBad.cs:9:25:9:47 | access to property QueryString | access to property QueryString |
+| ConsoleUncontrolledFormatString.cs:11:31:11:36 | access to local variable format | ConsoleUncontrolledFormatString.cs:8:22:8:39 | call to method ReadLine : String | ConsoleUncontrolledFormatString.cs:11:31:11:36 | access to local variable format | This format string depends on $@. | ConsoleUncontrolledFormatString.cs:8:22:8:39 | call to method ReadLine | thisexternal |
+| UncontrolledFormatString.cs:12:23:12:26 | access to local variable path | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString : NameValueCollection | UncontrolledFormatString.cs:12:23:12:26 | access to local variable path | This format string depends on $@. | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString | thisASP.NET query string |
+| UncontrolledFormatString.cs:15:46:15:49 | access to local variable path | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString : NameValueCollection | UncontrolledFormatString.cs:15:46:15:49 | access to local variable path | This format string depends on $@. | UncontrolledFormatString.cs:9:23:9:45 | access to property QueryString | thisASP.NET query string |
+| UncontrolledFormatString.cs:32:23:32:31 | access to property Text | UncontrolledFormatString.cs:32:23:32:31 | access to property Text | UncontrolledFormatString.cs:32:23:32:31 | access to property Text | This format string depends on $@. | UncontrolledFormatString.cs:32:23:32:31 | access to property Text | thisTextBox text |
+| UncontrolledFormatStringBad.cs:12:39:12:44 | access to local variable format | UncontrolledFormatStringBad.cs:9:25:9:47 | access to property QueryString : NameValueCollection | UncontrolledFormatStringBad.cs:12:39:12:44 | access to local variable format | This format string depends on $@. | UncontrolledFormatStringBad.cs:9:25:9:47 | access to property QueryString | thisASP.NET query string |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-201/ExposureInTransmittedData/ExposureInTransmittedData.expected b/csharp/ql/test/query-tests/Security Features/CWE-201/ExposureInTransmittedData/ExposureInTransmittedData.expected
index 6862c7c3dc4..9399dd0a6eb 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-201/ExposureInTransmittedData/ExposureInTransmittedData.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-201/ExposureInTransmittedData/ExposureInTransmittedData.expected
@@ -18,12 +18,12 @@ nodes
| ExposureInTransmittedData.cs:33:27:33:27 | access to local variable p | semmle.label | access to local variable p |
subpaths
#select
-| ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | access to local variable password |
-| ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | call to method ToString |
-| ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | access to property Message |
-| ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | call to method ToString |
-| ExposureInTransmittedData.cs:24:32:24:50 | access to indexer | ExposureInTransmittedData.cs:24:32:24:38 | access to property Data : IDictionary | ExposureInTransmittedData.cs:24:32:24:50 | access to indexer | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:24:32:24:38 | access to property Data | access to property Data : IDictionary |
-| ExposureInTransmittedData.cs:31:53:31:53 | access to local variable p | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:31:53:31:53 | access to local variable p | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | call to method GetField : String |
-| ExposureInTransmittedData.cs:31:56:31:56 | access to local variable p | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:31:56:31:56 | access to local variable p | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | call to method GetField : String |
-| ExposureInTransmittedData.cs:32:24:32:52 | ... + ... | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:32:24:32:52 | ... + ... | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | call to method GetField : String |
-| ExposureInTransmittedData.cs:33:27:33:27 | access to local variable p | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:33:27:33:27 | access to local variable p | Sensitive information from $@ flows to here, and is transmitted to the user. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | call to method GetField : String |
+| ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:14:32:14:39 | access to local variable password | sensitive information |
+| ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:18:32:18:44 | call to method ToString | sensitive information |
+| ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:22:32:22:41 | access to property Message | sensitive information |
+| ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:23:32:23:44 | call to method ToString | sensitive information |
+| ExposureInTransmittedData.cs:24:32:24:50 | access to indexer | ExposureInTransmittedData.cs:24:32:24:38 | access to property Data : IDictionary | ExposureInTransmittedData.cs:24:32:24:50 | access to indexer | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:24:32:24:38 | access to property Data | sensitive information |
+| ExposureInTransmittedData.cs:31:53:31:53 | access to local variable p | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:31:53:31:53 | access to local variable p | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | sensitive information |
+| ExposureInTransmittedData.cs:31:56:31:56 | access to local variable p | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:31:56:31:56 | access to local variable p | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | sensitive information |
+| ExposureInTransmittedData.cs:32:24:32:52 | ... + ... | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:32:24:32:52 | ... + ... | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | sensitive information |
+| ExposureInTransmittedData.cs:33:27:33:27 | access to local variable p | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField : String | ExposureInTransmittedData.cs:33:27:33:27 | access to local variable p | This data transmitted to the user depends on $@. | ExposureInTransmittedData.cs:30:17:30:36 | call to method GetField | sensitive information |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-209/ExceptionInformationExposure.expected b/csharp/ql/test/query-tests/Security Features/CWE-209/ExceptionInformationExposure.expected
index 3ad51c3a585..3e273ef83b8 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-209/ExceptionInformationExposure.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-209/ExceptionInformationExposure.expected
@@ -21,10 +21,10 @@ nodes
| ExceptionInformationExposure.cs:47:28:47:55 | call to method ToString | semmle.label | call to method ToString |
subpaths
#select
-| ExceptionInformationExposure.cs:19:32:19:44 | call to method ToString | ExceptionInformationExposure.cs:19:32:19:33 | access to local variable ex : Exception | ExceptionInformationExposure.cs:19:32:19:44 | call to method ToString | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:19:32:19:33 | access to local variable ex | access to local variable ex : Exception |
-| ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | access to local variable ex |
-| ExceptionInformationExposure.cs:23:32:23:44 | access to property StackTrace | ExceptionInformationExposure.cs:23:32:23:33 | access to local variable ex : Exception | ExceptionInformationExposure.cs:23:32:23:44 | access to property StackTrace | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:23:32:23:33 | access to local variable ex | access to local variable ex : Exception |
-| ExceptionInformationExposure.cs:39:28:39:55 | access to property StackTrace | ExceptionInformationExposure.cs:39:28:39:44 | access to property InnerException : Exception | ExceptionInformationExposure.cs:39:28:39:55 | access to property StackTrace | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:39:28:39:44 | access to property InnerException | access to property InnerException : Exception |
-| ExceptionInformationExposure.cs:40:28:40:40 | access to property StackTrace | ExceptionInformationExposure.cs:40:28:40:29 | access to local variable ex : Exception | ExceptionInformationExposure.cs:40:28:40:40 | access to property StackTrace | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:40:28:40:29 | access to local variable ex | access to local variable ex : Exception |
-| ExceptionInformationExposure.cs:41:28:41:40 | call to method ToString | ExceptionInformationExposure.cs:41:28:41:29 | access to local variable ex : Exception | ExceptionInformationExposure.cs:41:28:41:40 | call to method ToString | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:41:28:41:29 | access to local variable ex | access to local variable ex : Exception |
-| ExceptionInformationExposure.cs:47:28:47:55 | call to method ToString | ExceptionInformationExposure.cs:47:28:47:44 | object creation of type MyException : MyException | ExceptionInformationExposure.cs:47:28:47:55 | call to method ToString | Exception information from $@ flows to here, and is exposed to the user. | ExceptionInformationExposure.cs:47:28:47:44 | object creation of type MyException | object creation of type MyException : MyException |
+| ExceptionInformationExposure.cs:19:32:19:44 | call to method ToString | ExceptionInformationExposure.cs:19:32:19:33 | access to local variable ex : Exception | ExceptionInformationExposure.cs:19:32:19:44 | call to method ToString | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:19:32:19:33 | access to local variable ex | exception information |
+| ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:21:32:21:33 | access to local variable ex | exception information |
+| ExceptionInformationExposure.cs:23:32:23:44 | access to property StackTrace | ExceptionInformationExposure.cs:23:32:23:33 | access to local variable ex : Exception | ExceptionInformationExposure.cs:23:32:23:44 | access to property StackTrace | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:23:32:23:33 | access to local variable ex | exception information |
+| ExceptionInformationExposure.cs:39:28:39:55 | access to property StackTrace | ExceptionInformationExposure.cs:39:28:39:44 | access to property InnerException : Exception | ExceptionInformationExposure.cs:39:28:39:55 | access to property StackTrace | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:39:28:39:44 | access to property InnerException | exception information |
+| ExceptionInformationExposure.cs:40:28:40:40 | access to property StackTrace | ExceptionInformationExposure.cs:40:28:40:29 | access to local variable ex : Exception | ExceptionInformationExposure.cs:40:28:40:40 | access to property StackTrace | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:40:28:40:29 | access to local variable ex | exception information |
+| ExceptionInformationExposure.cs:41:28:41:40 | call to method ToString | ExceptionInformationExposure.cs:41:28:41:29 | access to local variable ex : Exception | ExceptionInformationExposure.cs:41:28:41:40 | call to method ToString | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:41:28:41:29 | access to local variable ex | exception information |
+| ExceptionInformationExposure.cs:47:28:47:55 | call to method ToString | ExceptionInformationExposure.cs:47:28:47:44 | object creation of type MyException : MyException | ExceptionInformationExposure.cs:47:28:47:55 | call to method ToString | This information exposed to the user depends on $@. | ExceptionInformationExposure.cs:47:28:47:44 | object creation of type MyException | exception information |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-312/CleartextStorage.expected b/csharp/ql/test/query-tests/Security Features/CWE-312/CleartextStorage.expected
index e4a9695a3f0..d8a6cbf5534 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-312/CleartextStorage.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-312/CleartextStorage.expected
@@ -10,11 +10,11 @@ nodes
| CleartextStorage.cs:74:21:74:29 | access to property Text | semmle.label | access to property Text |
subpaths
#select
-| CleartextStorage.cs:13:50:13:59 | access to field accountKey | CleartextStorage.cs:13:50:13:59 | access to field accountKey | CleartextStorage.cs:13:50:13:59 | access to field accountKey | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:13:50:13:59 | access to field accountKey | access to field accountKey |
-| CleartextStorage.cs:14:62:14:74 | call to method GetPassword | CleartextStorage.cs:14:62:14:74 | call to method GetPassword | CleartextStorage.cs:14:62:14:74 | call to method GetPassword | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:14:62:14:74 | call to method GetPassword | call to method GetPassword |
-| CleartextStorage.cs:15:69:15:81 | call to method GetPassword | CleartextStorage.cs:15:69:15:81 | call to method GetPassword | CleartextStorage.cs:15:69:15:81 | call to method GetPassword | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:15:69:15:81 | call to method GetPassword | call to method GetPassword |
-| CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | call to method GetAccountID |
-| CleartextStorage.cs:24:21:24:33 | call to method GetPassword | CleartextStorage.cs:24:21:24:33 | call to method GetPassword | CleartextStorage.cs:24:21:24:33 | call to method GetPassword | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:24:21:24:33 | call to method GetPassword | call to method GetPassword |
-| CleartextStorage.cs:72:21:72:33 | access to property Text | CleartextStorage.cs:72:21:72:33 | access to property Text | CleartextStorage.cs:72:21:72:33 | access to property Text | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:72:21:72:33 | access to property Text | access to property Text |
-| CleartextStorage.cs:73:21:73:29 | access to property Text | CleartextStorage.cs:73:21:73:29 | access to property Text | CleartextStorage.cs:73:21:73:29 | access to property Text | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:73:21:73:29 | access to property Text | access to property Text |
-| CleartextStorage.cs:74:21:74:29 | access to property Text | CleartextStorage.cs:74:21:74:29 | access to property Text | CleartextStorage.cs:74:21:74:29 | access to property Text | Sensitive data returned by $@ is stored here. | CleartextStorage.cs:74:21:74:29 | access to property Text | access to property Text |
+| CleartextStorage.cs:13:50:13:59 | access to field accountKey | CleartextStorage.cs:13:50:13:59 | access to field accountKey | CleartextStorage.cs:13:50:13:59 | access to field accountKey | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:13:50:13:59 | access to field accountKey | access to field accountKey |
+| CleartextStorage.cs:14:62:14:74 | call to method GetPassword | CleartextStorage.cs:14:62:14:74 | call to method GetPassword | CleartextStorage.cs:14:62:14:74 | call to method GetPassword | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:14:62:14:74 | call to method GetPassword | call to method GetPassword |
+| CleartextStorage.cs:15:69:15:81 | call to method GetPassword | CleartextStorage.cs:15:69:15:81 | call to method GetPassword | CleartextStorage.cs:15:69:15:81 | call to method GetPassword | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:15:69:15:81 | call to method GetPassword | call to method GetPassword |
+| CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:16:50:16:63 | call to method GetAccountID | call to method GetAccountID |
+| CleartextStorage.cs:24:21:24:33 | call to method GetPassword | CleartextStorage.cs:24:21:24:33 | call to method GetPassword | CleartextStorage.cs:24:21:24:33 | call to method GetPassword | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:24:21:24:33 | call to method GetPassword | call to method GetPassword |
+| CleartextStorage.cs:72:21:72:33 | access to property Text | CleartextStorage.cs:72:21:72:33 | access to property Text | CleartextStorage.cs:72:21:72:33 | access to property Text | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:72:21:72:33 | access to property Text | access to property Text |
+| CleartextStorage.cs:73:21:73:29 | access to property Text | CleartextStorage.cs:73:21:73:29 | access to property Text | CleartextStorage.cs:73:21:73:29 | access to property Text | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:73:21:73:29 | access to property Text | access to property Text |
+| CleartextStorage.cs:74:21:74:29 | access to property Text | CleartextStorage.cs:74:21:74:29 | access to property Text | CleartextStorage.cs:74:21:74:29 | access to property Text | This stores sensitive data returned by $@ as clear text. | CleartextStorage.cs:74:21:74:29 | access to property Text | access to property Text |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-321/HardcodedSymmetricEncryptionKey/HardcodedSymmetricEncryptionKey.expected b/csharp/ql/test/query-tests/Security Features/CWE-321/HardcodedSymmetricEncryptionKey/HardcodedSymmetricEncryptionKey.expected
index 676148bd7ed..7c3a2a7339c 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-321/HardcodedSymmetricEncryptionKey/HardcodedSymmetricEncryptionKey.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-321/HardcodedSymmetricEncryptionKey/HardcodedSymmetricEncryptionKey.expected
@@ -1,7 +1,7 @@
-| HardcodedSymmetricEncryptionKey.cs:17:21:17:97 | array creation of type Byte[] | Hard-coded symmetric $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:17:21:17:97 | array creation of type Byte[] | key |
-| HardcodedSymmetricEncryptionKey.cs:22:23:22:99 | array creation of type Byte[] | Hard-coded symmetric $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:22:23:22:99 | array creation of type Byte[] | key |
-| HardcodedSymmetricEncryptionKey.cs:31:21:31:21 | access to local variable d | Hard-coded symmetric $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | key |
-| HardcodedSymmetricEncryptionKey.cs:68:87:68:94 | access to parameter password | Hard-coded symmetric $@ is used in symmetric algorithm in Decryptor(rgbKey, IV) | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | key |
-| HardcodedSymmetricEncryptionKey.cs:108:23:108:25 | access to parameter key | Hard-coded symmetric $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | key |
-| HardcodedSymmetricEncryptionKey.cs:121:87:121:89 | access to parameter key | Hard-coded symmetric $@ is used in symmetric algorithm in Encryptor(rgbKey, IV) | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | key |
-| HardcodedSymmetricEncryptionKey.cs:121:87:121:89 | access to parameter key | Hard-coded symmetric $@ is used in symmetric algorithm in Encryptor(rgbKey, IV) | HardcodedSymmetricEncryptionKey.cs:28:62:28:115 | "Hello, world: here is a very bad way to create a key" | key |
+| HardcodedSymmetricEncryptionKey.cs:17:21:17:97 | array creation of type Byte[] | This hard-coded $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:17:21:17:97 | array creation of type Byte[] | symmetric key |
+| HardcodedSymmetricEncryptionKey.cs:22:23:22:99 | array creation of type Byte[] | This hard-coded $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:22:23:22:99 | array creation of type Byte[] | symmetric key |
+| HardcodedSymmetricEncryptionKey.cs:31:21:31:21 | access to local variable d | This hard-coded $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | symmetric key |
+| HardcodedSymmetricEncryptionKey.cs:68:87:68:94 | access to parameter password | This hard-coded $@ is used in symmetric algorithm in Decryptor(rgbKey, IV) | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | symmetric key |
+| HardcodedSymmetricEncryptionKey.cs:108:23:108:25 | access to parameter key | This hard-coded $@ is used in symmetric algorithm in Key property assignment | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | symmetric key |
+| HardcodedSymmetricEncryptionKey.cs:121:87:121:89 | access to parameter key | This hard-coded $@ is used in symmetric algorithm in Encryptor(rgbKey, IV) | HardcodedSymmetricEncryptionKey.cs:25:21:25:97 | array creation of type Byte[] | symmetric key |
+| HardcodedSymmetricEncryptionKey.cs:121:87:121:89 | access to parameter key | This hard-coded $@ is used in symmetric algorithm in Encryptor(rgbKey, IV) | HardcodedSymmetricEncryptionKey.cs:28:62:28:115 | "Hello, world: here is a very bad way to create a key" | symmetric key |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-327/DontInstallRootCert/DontInstallRootCert.expected b/csharp/ql/test/query-tests/Security Features/CWE-327/DontInstallRootCert/DontInstallRootCert.expected
index f4a30f5b52c..9f20b582a86 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-327/DontInstallRootCert/DontInstallRootCert.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-327/DontInstallRootCert/DontInstallRootCert.expected
@@ -11,6 +11,6 @@ nodes
| Test.cs:73:13:73:17 | access to local variable store | semmle.label | access to local variable store |
subpaths
#select
-| Test.cs:18:13:18:17 | access to local variable store | Test.cs:15:31:15:59 | object creation of type X509Store : X509Store | Test.cs:18:13:18:17 | access to local variable store | Certificate added to the root certificate store. |
-| Test.cs:28:13:28:17 | access to local variable store | Test.cs:25:31:25:86 | object creation of type X509Store : X509Store | Test.cs:28:13:28:17 | access to local variable store | Certificate added to the root certificate store. |
-| Test.cs:73:13:73:17 | access to local variable store | Test.cs:70:31:70:86 | object creation of type X509Store : X509Store | Test.cs:73:13:73:17 | access to local variable store | Certificate added to the root certificate store. |
+| Test.cs:18:13:18:17 | access to local variable store | Test.cs:15:31:15:59 | object creation of type X509Store : X509Store | Test.cs:18:13:18:17 | access to local variable store | This certificate is added to the root certificate store. |
+| Test.cs:28:13:28:17 | access to local variable store | Test.cs:25:31:25:86 | object creation of type X509Store : X509Store | Test.cs:28:13:28:17 | access to local variable store | This certificate is added to the root certificate store. |
+| Test.cs:73:13:73:17 | access to local variable store | Test.cs:70:31:70:86 | object creation of type X509Store : X509Store | Test.cs:73:13:73:17 | access to local variable store | This certificate is added to the root certificate store. |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-327/InsecureSQLConnection/InsecureSQLConnection.expected b/csharp/ql/test/query-tests/Security Features/CWE-327/InsecureSQLConnection/InsecureSQLConnection.expected
index c989ceb4c73..14d9e9213c6 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-327/InsecureSQLConnection/InsecureSQLConnection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-327/InsecureSQLConnection/InsecureSQLConnection.expected
@@ -9,6 +9,6 @@ nodes
| InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | semmle.label | access to local variable connectString |
subpaths
#select
-| InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | $@ flows to here and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | Connection string |
-| InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" : String | InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | $@ flows to here and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" | Connection string |
-| InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" : String | InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | $@ flows to here and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" | Connection string |
+| InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | $@ flows to this SQL connection and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | Connection string |
+| InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" : String | InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | $@ flows to this SQL connection and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" | Connection string |
+| InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" : String | InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | $@ flows to this SQL connection and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" | Connection string |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-338/InsecureRandomness.expected b/csharp/ql/test/query-tests/Security Features/CWE-338/InsecureRandomness.expected
index 4bab46b6292..07cdf34f0c9 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-338/InsecureRandomness.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-338/InsecureRandomness.expected
@@ -32,7 +32,7 @@ nodes
| InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | semmle.label | call to method GeneratePassword |
subpaths
#select
-| InsecureRandomness.cs:12:27:12:50 | call to method InsecureRandomString | InsecureRandomness.cs:28:29:28:43 | call to method Next : Int32 | InsecureRandomness.cs:12:27:12:50 | call to method InsecureRandomString | Cryptographically insecure random number is generated at $@ and used here in a security context. | InsecureRandomness.cs:28:29:28:43 | call to method Next | call to method Next |
-| InsecureRandomness.cs:13:20:13:56 | call to method InsecureRandomStringFromSelection | InsecureRandomness.cs:60:31:60:39 | call to method Next : Int32 | InsecureRandomness.cs:13:20:13:56 | call to method InsecureRandomStringFromSelection | Cryptographically insecure random number is generated at $@ and used here in a security context. | InsecureRandomness.cs:60:31:60:39 | call to method Next | call to method Next |
-| InsecureRandomness.cs:14:20:14:54 | call to method InsecureRandomStringFromIndexer | InsecureRandomness.cs:72:31:72:39 | call to method Next : Int32 | InsecureRandomness.cs:14:20:14:54 | call to method InsecureRandomStringFromIndexer | Cryptographically insecure random number is generated at $@ and used here in a security context. | InsecureRandomness.cs:72:31:72:39 | call to method Next | call to method Next |
-| InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | Cryptographically insecure random number is generated at $@ and used here in a security context. | InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | call to method GeneratePassword |
+| InsecureRandomness.cs:12:27:12:50 | call to method InsecureRandomString | InsecureRandomness.cs:28:29:28:43 | call to method Next : Int32 | InsecureRandomness.cs:12:27:12:50 | call to method InsecureRandomString | This uses a cryptographically insecure random number generated at $@ in a security context. | InsecureRandomness.cs:28:29:28:43 | call to method Next | call to method Next |
+| InsecureRandomness.cs:13:20:13:56 | call to method InsecureRandomStringFromSelection | InsecureRandomness.cs:60:31:60:39 | call to method Next : Int32 | InsecureRandomness.cs:13:20:13:56 | call to method InsecureRandomStringFromSelection | This uses a cryptographically insecure random number generated at $@ in a security context. | InsecureRandomness.cs:60:31:60:39 | call to method Next | call to method Next |
+| InsecureRandomness.cs:14:20:14:54 | call to method InsecureRandomStringFromIndexer | InsecureRandomness.cs:72:31:72:39 | call to method Next : Int32 | InsecureRandomness.cs:14:20:14:54 | call to method InsecureRandomStringFromIndexer | This uses a cryptographically insecure random number generated at $@ in a security context. | InsecureRandomness.cs:72:31:72:39 | call to method Next | call to method Next |
+| InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | This uses a cryptographically insecure random number generated at $@ in a security context. | InsecureRandomness.cs:80:28:80:81 | call to method GeneratePassword | call to method GeneratePassword |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-384/AbandonSession.expected b/csharp/ql/test/query-tests/Security Features/CWE-384/AbandonSession.expected
index 026fc775cff..fb6df84da98 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-384/AbandonSession.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-384/AbandonSession.expected
@@ -1,3 +1,3 @@
-| AbandonSession.cs:11:13:11:23 | access to property Session | This session has not been invalidated following the call to '$@'. | AbandonSession.cs:9:13:9:68 | call to method Authenticate | Authenticate |
-| AbandonSession.cs:51:13:51:23 | access to property Session | This session has not been invalidated following the call to '$@'. | AbandonSession.cs:49:13:49:59 | call to method ValidateUser | ValidateUser |
-| AbandonSession.cs:53:9:53:19 | access to property Session | This session has not been invalidated following the call to '$@'. | AbandonSession.cs:49:13:49:59 | call to method ValidateUser | ValidateUser |
+| AbandonSession.cs:11:13:11:23 | access to property Session | This session has not been invalidated following the call to $@. | AbandonSession.cs:9:13:9:68 | call to method Authenticate | Authenticate |
+| AbandonSession.cs:51:13:51:23 | access to property Session | This session has not been invalidated following the call to $@. | AbandonSession.cs:49:13:49:59 | call to method ValidateUser | ValidateUser |
+| AbandonSession.cs:53:9:53:19 | access to property Session | This session has not been invalidated following the call to $@. | AbandonSession.cs:49:13:49:59 | call to method ValidateUser | ValidateUser |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-611/UntrustedDataInsecureXml.expected b/csharp/ql/test/query-tests/Security Features/CWE-611/UntrustedDataInsecureXml.expected
index 39b2fc91541..c6e463428a6 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-611/UntrustedDataInsecureXml.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-611/UntrustedDataInsecureXml.expected
@@ -5,4 +5,4 @@ nodes
| Test.cs:11:50:11:84 | access to indexer | semmle.label | access to indexer |
subpaths
#select
-| Test.cs:11:50:11:84 | access to indexer | Test.cs:11:50:11:72 | access to property QueryString : NameValueCollection | Test.cs:11:50:11:84 | access to indexer | $@ flows to here and is loaded insecurely as XML (DTD processing is enabled with an insecure resolver). | Test.cs:11:50:11:72 | access to property QueryString | User-provided value |
+| Test.cs:11:50:11:84 | access to indexer | Test.cs:11:50:11:72 | access to property QueryString : NameValueCollection | Test.cs:11:50:11:84 | access to indexer | This insecure XML processing depends on a $@ (DTD processing is enabled with an insecure resolver). | Test.cs:11:50:11:72 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-643/StoredXPathInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-643/StoredXPathInjection.expected
index cada6a7e427..63235e25c92 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-643/StoredXPathInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-643/StoredXPathInjection.expected
@@ -10,7 +10,7 @@ nodes
| StoredXPathInjection.cs:28:41:28:144 | ... + ... | semmle.label | ... + ... |
subpaths
#select
-| StoredXPathInjection.cs:25:45:25:148 | ... + ... | StoredXPathInjection.cs:22:39:22:65 | call to method GetString : String | StoredXPathInjection.cs:25:45:25:148 | ... + ... | $@ flows to here and is used in an XPath expression. | StoredXPathInjection.cs:22:39:22:65 | call to method GetString | Stored user-provided value |
-| StoredXPathInjection.cs:25:45:25:148 | ... + ... | StoredXPathInjection.cs:23:39:23:65 | call to method GetString : String | StoredXPathInjection.cs:25:45:25:148 | ... + ... | $@ flows to here and is used in an XPath expression. | StoredXPathInjection.cs:23:39:23:65 | call to method GetString | Stored user-provided value |
-| StoredXPathInjection.cs:28:41:28:144 | ... + ... | StoredXPathInjection.cs:22:39:22:65 | call to method GetString : String | StoredXPathInjection.cs:28:41:28:144 | ... + ... | $@ flows to here and is used in an XPath expression. | StoredXPathInjection.cs:22:39:22:65 | call to method GetString | Stored user-provided value |
-| StoredXPathInjection.cs:28:41:28:144 | ... + ... | StoredXPathInjection.cs:23:39:23:65 | call to method GetString : String | StoredXPathInjection.cs:28:41:28:144 | ... + ... | $@ flows to here and is used in an XPath expression. | StoredXPathInjection.cs:23:39:23:65 | call to method GetString | Stored user-provided value |
+| StoredXPathInjection.cs:25:45:25:148 | ... + ... | StoredXPathInjection.cs:22:39:22:65 | call to method GetString : String | StoredXPathInjection.cs:25:45:25:148 | ... + ... | This XPath expression depends on a $@. | StoredXPathInjection.cs:22:39:22:65 | call to method GetString | stored (potentially user-provided) value |
+| StoredXPathInjection.cs:25:45:25:148 | ... + ... | StoredXPathInjection.cs:23:39:23:65 | call to method GetString : String | StoredXPathInjection.cs:25:45:25:148 | ... + ... | This XPath expression depends on a $@. | StoredXPathInjection.cs:23:39:23:65 | call to method GetString | stored (potentially user-provided) value |
+| StoredXPathInjection.cs:28:41:28:144 | ... + ... | StoredXPathInjection.cs:22:39:22:65 | call to method GetString : String | StoredXPathInjection.cs:28:41:28:144 | ... + ... | This XPath expression depends on a $@. | StoredXPathInjection.cs:22:39:22:65 | call to method GetString | stored (potentially user-provided) value |
+| StoredXPathInjection.cs:28:41:28:144 | ... + ... | StoredXPathInjection.cs:23:39:23:65 | call to method GetString : String | StoredXPathInjection.cs:28:41:28:144 | ... + ... | This XPath expression depends on a $@. | StoredXPathInjection.cs:23:39:23:65 | call to method GetString | stored (potentially user-provided) value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-643/XPathInjection.expected b/csharp/ql/test/query-tests/Security Features/CWE-643/XPathInjection.expected
index c5fbc6b2a66..fa812c210ed 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-643/XPathInjection.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-643/XPathInjection.expected
@@ -43,17 +43,17 @@ nodes
| XPathInjection.cs:52:21:52:21 | access to local variable s | semmle.label | access to local variable s |
subpaths
#select
-| XPathInjection.cs:16:33:16:33 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:16:33:16:33 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:16:33:16:33 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:16:33:16:33 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:19:29:19:29 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:19:29:19:29 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:19:29:19:29 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:19:29:19:29 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:28:20:28:20 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:28:20:28:20 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:28:20:28:20 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:28:20:28:20 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:34:30:34:30 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:34:30:34:30 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:34:30:34:30 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:34:30:34:30 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:40:21:40:21 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:40:21:40:21 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:40:21:40:21 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:40:21:40:21 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:46:22:46:22 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:46:22:46:22 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:46:22:46:22 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:46:22:46:22 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:52:21:52:21 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:52:21:52:21 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:10:27:10:49 | access to property QueryString | User-provided value |
-| XPathInjection.cs:52:21:52:21 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:52:21:52:21 | access to local variable s | $@ flows to here and is used in an XPath expression. | XPathInjection.cs:11:27:11:49 | access to property QueryString | User-provided value |
+| XPathInjection.cs:16:33:16:33 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:16:33:16:33 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:16:33:16:33 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:16:33:16:33 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:19:29:19:29 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:19:29:19:29 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:19:29:19:29 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:19:29:19:29 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:28:20:28:20 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:28:20:28:20 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:28:20:28:20 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:28:20:28:20 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:34:30:34:30 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:34:30:34:30 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:34:30:34:30 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:34:30:34:30 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:40:21:40:21 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:40:21:40:21 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:40:21:40:21 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:40:21:40:21 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:46:22:46:22 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:46:22:46:22 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:46:22:46:22 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:46:22:46:22 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:52:21:52:21 | access to local variable s | XPathInjection.cs:10:27:10:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:52:21:52:21 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:10:27:10:49 | access to property QueryString | user-provided value |
+| XPathInjection.cs:52:21:52:21 | access to local variable s | XPathInjection.cs:11:27:11:49 | access to property QueryString : NameValueCollection | XPathInjection.cs:52:21:52:21 | access to local variable s | This XPath expression depends on a $@. | XPathInjection.cs:11:27:11:49 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-730/ReDoS/ReDoS.expected b/csharp/ql/test/query-tests/Security Features/CWE-730/ReDoS/ReDoS.expected
index 19549b0dcb3..8f378704ce5 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-730/ReDoS/ReDoS.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-730/ReDoS/ReDoS.expected
@@ -20,8 +20,8 @@ nodes
| ExponentialRegex.cs:24:21:24:29 | access to local variable userInput | semmle.label | access to local variable userInput |
subpaths
#select
-| ExponentialRegex.cs:15:40:15:48 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:15:40:15:48 | access to local variable userInput | $@ flows to regular expression operation with dangerous regex. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | User-provided value |
-| ExponentialRegex.cs:16:42:16:50 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:16:42:16:50 | access to local variable userInput | $@ flows to regular expression operation with dangerous regex. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | User-provided value |
-| ExponentialRegex.cs:19:139:19:147 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:19:139:19:147 | access to local variable userInput | $@ flows to regular expression operation with dangerous regex. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | User-provided value |
-| ExponentialRegex.cs:22:43:22:51 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:22:43:22:51 | access to local variable userInput | $@ flows to regular expression operation with dangerous regex. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | User-provided value |
-| ExponentialRegex.cs:24:21:24:29 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:24:21:24:29 | access to local variable userInput | $@ flows to regular expression operation with dangerous regex. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | User-provided value |
+| ExponentialRegex.cs:15:40:15:48 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:15:40:15:48 | access to local variable userInput | This regex operation with dangerous complexity depends on a $@. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | user-provided value |
+| ExponentialRegex.cs:16:42:16:50 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:16:42:16:50 | access to local variable userInput | This regex operation with dangerous complexity depends on a $@. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | user-provided value |
+| ExponentialRegex.cs:19:139:19:147 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:19:139:19:147 | access to local variable userInput | This regex operation with dangerous complexity depends on a $@. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | user-provided value |
+| ExponentialRegex.cs:22:43:22:51 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:22:43:22:51 | access to local variable userInput | This regex operation with dangerous complexity depends on a $@. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | user-provided value |
+| ExponentialRegex.cs:24:21:24:29 | access to local variable userInput | ExponentialRegex.cs:11:28:11:50 | access to property QueryString : NameValueCollection | ExponentialRegex.cs:24:21:24:29 | access to local variable userInput | This regex operation with dangerous complexity depends on a $@. | ExponentialRegex.cs:11:28:11:50 | access to property QueryString | user-provided value |
diff --git a/csharp/ql/test/query-tests/Security Features/CWE-807/ConditionalBypass.expected b/csharp/ql/test/query-tests/Security Features/CWE-807/ConditionalBypass.expected
index 5e5b963f9f6..3f985cd5eff 100644
--- a/csharp/ql/test/query-tests/Security Features/CWE-807/ConditionalBypass.expected
+++ b/csharp/ql/test/query-tests/Security Features/CWE-807/ConditionalBypass.expected
@@ -46,11 +46,11 @@ nodes
| ConditionalBypass.cs:84:13:84:40 | ... == ... | semmle.label | ... == ... |
subpaths
#select
-| ConditionalBypass.cs:17:13:17:33 | call to method login | ConditionalBypass.cs:12:26:12:48 | access to property QueryString : NameValueCollection | ConditionalBypass.cs:16:13:16:30 | ... == ... | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:16:13:16:30 | ... == ... | this condition | ConditionalBypass.cs:12:26:12:48 | access to property QueryString | user input |
-| ConditionalBypass.cs:23:13:23:33 | call to method login | ConditionalBypass.cs:19:34:19:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:22:13:22:45 | call to method Equals | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:22:13:22:45 | call to method Equals | this condition | ConditionalBypass.cs:19:34:19:52 | access to property Cookies | user input |
-| ConditionalBypass.cs:29:13:29:33 | call to method login | ConditionalBypass.cs:19:34:19:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:27:13:27:40 | ... == ... | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:27:13:27:40 | ... == ... | this condition | ConditionalBypass.cs:19:34:19:52 | access to property Cookies | user input |
-| ConditionalBypass.cs:33:13:33:39 | call to method reCheckAuth | ConditionalBypass.cs:19:34:19:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:27:13:27:40 | ... == ... | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:27:13:27:40 | ... == ... | this condition | ConditionalBypass.cs:19:34:19:52 | access to property Cookies | user input |
-| ConditionalBypass.cs:46:13:46:33 | call to method login | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress : IPHostEntry | ConditionalBypass.cs:44:13:44:46 | ... == ... | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:44:13:44:46 | ... == ... | this condition | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress | user input |
-| ConditionalBypass.cs:51:13:51:33 | call to method login | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress : IPHostEntry | ConditionalBypass.cs:49:13:49:29 | access to property HostName | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:49:13:49:29 | access to property HostName | this condition | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress | user input |
-| ConditionalBypass.cs:73:13:73:33 | call to method login | ConditionalBypass.cs:70:34:70:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:72:13:72:40 | ... == ... | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:72:13:72:40 | ... == ... | this condition | ConditionalBypass.cs:70:34:70:52 | access to property Cookies | user input |
-| ConditionalBypass.cs:85:13:85:33 | call to method login | ConditionalBypass.cs:83:34:83:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:84:13:84:40 | ... == ... | Sensitive method may not be executed depending on $@, which flows from $@. | ConditionalBypass.cs:84:13:84:40 | ... == ... | this condition | ConditionalBypass.cs:83:34:83:52 | access to property Cookies | user input |
+| ConditionalBypass.cs:16:13:16:30 | ... == ... | ConditionalBypass.cs:12:26:12:48 | access to property QueryString : NameValueCollection | ConditionalBypass.cs:16:13:16:30 | ... == ... | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:17:13:17:33 | call to method login | action | ConditionalBypass.cs:12:26:12:48 | access to property QueryString | user-provided value |
+| ConditionalBypass.cs:22:13:22:45 | call to method Equals | ConditionalBypass.cs:19:34:19:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:22:13:22:45 | call to method Equals | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:23:13:23:33 | call to method login | action | ConditionalBypass.cs:19:34:19:52 | access to property Cookies | user-provided value |
+| ConditionalBypass.cs:27:13:27:40 | ... == ... | ConditionalBypass.cs:19:34:19:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:27:13:27:40 | ... == ... | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:29:13:29:33 | call to method login | action | ConditionalBypass.cs:19:34:19:52 | access to property Cookies | user-provided value |
+| ConditionalBypass.cs:27:13:27:40 | ... == ... | ConditionalBypass.cs:19:34:19:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:27:13:27:40 | ... == ... | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:33:13:33:39 | call to method reCheckAuth | action | ConditionalBypass.cs:19:34:19:52 | access to property Cookies | user-provided value |
+| ConditionalBypass.cs:44:13:44:46 | ... == ... | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress : IPHostEntry | ConditionalBypass.cs:44:13:44:46 | ... == ... | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:46:13:46:33 | call to method login | action | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress | user-provided value |
+| ConditionalBypass.cs:49:13:49:29 | access to property HostName | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress : IPHostEntry | ConditionalBypass.cs:49:13:49:29 | access to property HostName | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:51:13:51:33 | call to method login | action | ConditionalBypass.cs:42:32:42:66 | call to method GetHostByAddress | user-provided value |
+| ConditionalBypass.cs:72:13:72:40 | ... == ... | ConditionalBypass.cs:70:34:70:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:72:13:72:40 | ... == ... | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:73:13:73:33 | call to method login | action | ConditionalBypass.cs:70:34:70:52 | access to property Cookies | user-provided value |
+| ConditionalBypass.cs:84:13:84:40 | ... == ... | ConditionalBypass.cs:83:34:83:52 | access to property Cookies : HttpCookieCollection | ConditionalBypass.cs:84:13:84:40 | ... == ... | This condition guards a sensitive $@, but a $@ controls it. | ConditionalBypass.cs:85:13:85:33 | call to method login | action | ConditionalBypass.cs:83:34:83:52 | access to property Cookies | user-provided value |
diff --git a/csharp/tools/tracing-config.lua b/csharp/tools/tracing-config.lua
index b8a4d4ed847..2db04d83524 100644
--- a/csharp/tools/tracing-config.lua
+++ b/csharp/tools/tracing-config.lua
@@ -21,8 +21,8 @@ function RegisterExtractorPack(id)
-- if that's `build`, we append `-p:UseSharedCompilation=false` to the command line,
-- otherwise we do nothing.
local match = false
- local needsSeparator = false;
- local injectionIndex = nil;
+ local dotnetRunNeedsSeparator = false;
+ local dotnetRunInjectionIndex = nil;
local argv = compilerArguments.argv
if OperatingSystem == 'windows' then
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -34,7 +34,9 @@ function RegisterExtractorPack(id)
-- dotnet options start with either - or / (both are legal)
local firstCharacter = string.sub(arg, 1, 1)
if not (firstCharacter == '-') and not (firstCharacter == '/') then
- Log(1, 'Dotnet subcommand detected: %s', arg)
+ if (not match) then
+ Log(1, 'Dotnet subcommand detected: %s', arg)
+ end
if arg == 'build' or arg == 'msbuild' or arg == 'publish' or arg == 'pack' or arg == 'test' then
match = true
break
@@ -43,22 +45,29 @@ function RegisterExtractorPack(id)
-- for `dotnet run`, we need to make sure that `-p:UseSharedCompilation=false` is
-- not passed in as an argument to the program that is run
match = true
- needsSeparator = true
- injectionIndex = i + 1
+ dotnetRunNeedsSeparator = true
+ dotnetRunInjectionIndex = i + 1
end
end
+ -- if we see a separator to `dotnet run`, inject just prior to the existing separator
if arg == '--' then
- needsSeparator = false
- injectionIndex = i
+ dotnetRunNeedsSeparator = false
+ dotnetRunInjectionIndex = i
break
end
+ -- if we see an option to `dotnet run` (e.g., `--project`), inject just prior
+ -- to the last option
+ if firstCharacter == '-' then
+ dotnetRunNeedsSeparator = false
+ dotnetRunInjectionIndex = i
+ end
end
if match then
local injections = { '-p:UseSharedCompilation=false' }
- if needsSeparator then
+ if dotnetRunNeedsSeparator then
table.insert(injections, '--')
end
- if injectionIndex == nil then
+ if dotnetRunInjectionIndex == nil then
-- Simple case; just append at the end
return {
order = ORDER_REPLACE,
@@ -69,7 +78,7 @@ function RegisterExtractorPack(id)
-- Complex case; splice injections into the middle of the command line
for i, injectionArg in ipairs(injections) do
- table.insert(argv, injectionIndex + i - 1, injectionArg)
+ table.insert(argv, dotnetRunInjectionIndex + i - 1, injectionArg)
end
if OperatingSystem == 'windows' then
diff --git a/docs/codeql/codeql-cli/creating-codeql-query-suites.rst b/docs/codeql/codeql-cli/creating-codeql-query-suites.rst
index c65e1c42ad4..b95412a6dc2 100644
--- a/docs/codeql/codeql-cli/creating-codeql-query-suites.rst
+++ b/docs/codeql/codeql-cli/creating-codeql-query-suites.rst
@@ -359,20 +359,6 @@ definition using ``query compile``, or use the queries in an analysis using
``database analyze``. For more information about analyzing CodeQL databases, see
":doc:`Analyzing databases with the CodeQL CLI `."
-Viewing the query suites used on LGTM.com
------------------------------------------
-
-The query suite definitions used to select queries to run on LGTM.com can be
-found in the CodeQL repository. For example, to view the CodeQL queries for
-JavaScript, visit
-https://github.com/github/codeql/tree/main/javascript/ql/src/codeql-suites.
-
-These suite definitions apply reusable filter patterns to the queries
-located in the standard CodeQL packs for each supported language. For more
-information, see the `suite-helpers
-`__ in the CodeQL
-repository.
-
Further reading
---------------
diff --git a/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst b/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst
index b3ad59da2b5..af2fc646e95 100644
--- a/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst
+++ b/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst
@@ -143,6 +143,7 @@ up to create and analyze databases:
- ``codeql/cpp-queries``
- ``codeql/csharp-queries``
+ - ``codeql/go-queries``
- ``codeql/java-queries``
- ``codeql/javascript-queries``
- ``codeql/python-queries``
@@ -210,13 +211,9 @@ see ":doc:`About CodeQL packs `."
There are different versions of the CodeQL queries available for different
users. Check out the correct version for your use case:
- - For the queries used on `LGTM.com `__, check out the
- ``lgtm.com`` branch. You should use this branch for databases you've built
- using the CodeQL CLI, fetched from code scanning on GitHub, or recently downloaded from LGTM.com.
- The queries on the ``lgtm.com`` branch are more likely to be compatible
- with the ``latest`` CLI, so you'll be less likely to have to upgrade
- newly-created databases than if you use the ``main`` branch. Older databases
- may need to be upgraded before you can analyze them.
+ - For the queries that are intended to be used with the latest CodeQL CLI release, check out the
+ branch tagged ``codeql-cli/latest``. You should use this branch for databases you've built
+ using the CodeQL CLI, fetched from code scanning on GitHub, or recently downloaded from GitHub.com.
- For the most up to date CodeQL queries, check out the ``main`` branch.
This branch represents the very latest version of CodeQL's analysis.
@@ -268,7 +265,7 @@ Using two versions of the CodeQL CLI
If you want to use the latest CodeQL features to execute queries or CodeQL tests,
but also want to prepare databases that are compatible with a specific version of
-LGTM Enterprise, you may need to install two versions of the CLI. The
+CodeQL code scanning on GitHub Enterprise Server, you may need to install two versions of the CLI. The
recommended directory setup depends on which versions you want to install:
- If both versions are 2.0.2 (or newer), you can unpack both CLI archives in the
diff --git a/docs/codeql/codeql-for-visual-studio-code/setting-up-codeql-in-visual-studio-code.rst b/docs/codeql/codeql-for-visual-studio-code/setting-up-codeql-in-visual-studio-code.rst
index 5592992373b..f120518bd3f 100644
--- a/docs/codeql/codeql-for-visual-studio-code/setting-up-codeql-in-visual-studio-code.rst
+++ b/docs/codeql/codeql-for-visual-studio-code/setting-up-codeql-in-visual-studio-code.rst
@@ -21,7 +21,7 @@ You can install the CodeQL extension using any of the normal methods for install
* Go to the `Visual Studio Code Marketplace `__ in your browser and click **Install**.
* In the Extensions view (**Ctrl+Shift+X** or **Cmd+Shift+X**), search for ``CodeQL``, then select **Install**.
-* Download the `CodeQL VSIX file `__. Then, in the Extensions view, click **More actions** > **Install from VSIX**, and select the CodeQL VSIX file.
+* Download the `CodeQL VSIX file `__. Then, in the Extensions view, click the ellipsis representing the **Views and More Actions...** menu, select **Install from VSIX**, then select the CodeQL VSIX file.
Configuring access to the CodeQL CLI
------------------------------------
diff --git a/docs/codeql/codeql-language-guides/codeql-library-for-ruby.rst b/docs/codeql/codeql-language-guides/codeql-library-for-ruby.rst
index ad6ecdb591c..7db0028eb03 100644
--- a/docs/codeql/codeql-language-guides/codeql-library-for-ruby.rst
+++ b/docs/codeql/codeql-language-guides/codeql-library-for-ruby.rst
@@ -1,4 +1,4 @@
-.. codeql-library-for-ruby:
+.. _codeql-library-for-ruby:
CodeQL library for Ruby
=======================
diff --git a/docs/codeql/codeql-overview/index.rst b/docs/codeql/codeql-overview/index.rst
index aacb209cf4c..ad43d316535 100644
--- a/docs/codeql/codeql-overview/index.rst
+++ b/docs/codeql/codeql-overview/index.rst
@@ -9,6 +9,8 @@ Learn more about how CodeQL works, the languages and libraries supported by Code
- :doc:`Supported languages and frameworks `: View the languages, libraries, and frameworks supported in the latest version of CodeQL.
+- :doc:`System requirements `: View the system requirements for running the latest version of CodeQL.
+
- :doc:`CodeQL tools `: GitHub provides the CodeQL command-line interface and CodeQL for Visual Studio Code for performing CodeQL analysis on open source codebases.
- :doc:`CodeQL glossary `: An overview of the technical terms and concepts in CodeQL.
@@ -19,6 +21,7 @@ Learn more about how CodeQL works, the languages and libraries supported by Code
about-codeql
supported-languages-and-frameworks
+ system-requirements
codeql-tools
codeql-glossary
diff --git a/docs/codeql/codeql-overview/system-requirements.rst b/docs/codeql/codeql-overview/system-requirements.rst
new file mode 100644
index 00000000000..5569462e5ae
--- /dev/null
+++ b/docs/codeql/codeql-overview/system-requirements.rst
@@ -0,0 +1,35 @@
+:tocdepth: 1
+
+.. _system-requirements:
+
+System requirements
+-------------------
+
+System requirements for running the latest version of CodeQL.
+
+Supported platforms
+#######################
+
+.. include:: ../support/reusables/platforms.rst
+
+Additional software requirements
+################################
+
+To generate a CodeQL database for a compiled language, you must ensure that the system can successfully build and compile your code, independently of CodeQL.
+
+In addition, CodeQL extraction has the following requirements.
+
+For extraction of compiled languages (C/C++, C#, Go, Java) and Ruby on Linux:
+
+- ``glibc`` version 2.17 or greater must be installed.
+- ``musl-c``-based Linux distributions, such as Alpine Linux, are not supported.
+
+For TypeScript extraction on all platforms:
+
+- Node.js must be installed and available on the ``PATH`` as ``node``.
+
+For Python extraction:
+
+- On Linux and macOS, Python 3 must be installed and available on the ``PATH`` as ``python3`` or ``python``.
+- For Python 2 extraction on Linux and macOS, we also recommend having Python 2 installed and available on the ``PATH`` as ``python2``.
+- On Windows, the Python launcher must be installed and available on the ``PATH`` as ``py.exe``.
diff --git a/docs/codeql/index.html b/docs/codeql/index.html
index d69c275afe4..f369c3c7cb8 100644
--- a/docs/codeql/index.html
+++ b/docs/codeql/index.html
@@ -97,6 +97,13 @@
View the languages, libraries, and frameworks supported in the
latest version of CodeQL...
+
Academic publications
diff --git a/docs/codeql/support/reusables/frameworks.rst b/docs/codeql/support/reusables/frameworks.rst
index fc5410648cf..b83b26f486a 100644
--- a/docs/codeql/support/reusables/frameworks.rst
+++ b/docs/codeql/support/reusables/frameworks.rst
@@ -221,11 +221,17 @@ and the CodeQL library pack ``codeql/python-all`` (`changelog `__, `source `__)
+and the CodeQL library pack ``codeql/ruby-all`` (`changelog `__, `source `__).
+
+.. csv-table::
+ :header-rows: 1
+ :class: fullWidthTable
+ :widths: auto
+
+ Name, Category
+ excon, HTTP client
+ faraday, HTTP client
+ http_client, HTTP client
+ httparty, HTTP client
+ libxml-ruby, XML processing library
+ nokogiri, XML processing library
+ open-uri, HTTP client
+ posix-spawn, Utility library
+ rest-client, HTTP client
+ Ruby on Rails, Web framework
+ rubyzip, Compression library
+ typhoeus, HTTP client
+
diff --git a/docs/codeql/support/reusables/platforms.rst b/docs/codeql/support/reusables/platforms.rst
new file mode 100644
index 00000000000..5f9f1e91aae
--- /dev/null
+++ b/docs/codeql/support/reusables/platforms.rst
@@ -0,0 +1,29 @@
+.. csv-table::
+ :header-rows: 1
+ :widths: auto
+ :stub-columns: 1
+
+ Operating system,Supported versions,Supported CPU architectures
+ Linux,"Ubuntu 18.04
+
+ Ubuntu 20.04
+
+ Ubuntu 21.04
+
+ Ubuntu 22.04","x86-64"
+ Windows,"Windows 10 / Windows Server 2019
+
+ Windows 11 / Windows Server 2022","x86-64"
+ macOS,"macOS 10.15 Catalina
+
+ macOS 11 Big Sur
+
+ macOS 12 Monterey","x86-64
+
+ x86-64, arm64 (Apple Silicon)
+
+ x86-64, arm64 (Apple Silicon) [1]_"
+
+.. container:: footnote-group
+
+ .. [1] Support for Apple Silicon is currently in beta.
diff --git a/docs/codeql/support/reusables/versions-compilers.rst b/docs/codeql/support/reusables/versions-compilers.rst
index fbf6b67ffb6..797c9980e0a 100644
--- a/docs/codeql/support/reusables/versions-compilers.rst
+++ b/docs/codeql/support/reusables/versions-compilers.rst
@@ -22,7 +22,7 @@
Eclipse compiler for Java (ECJ) [5]_",``.java``
JavaScript,ECMAScript 2022 or lower,Not applicable,"``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhtm``, ``.xhtml``, ``.vue``, ``.hbs``, ``.ejs``, ``.njk``, ``.json``, ``.yaml``, ``.yml``, ``.raml``, ``.xml`` [6]_"
Python [7]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10",Not applicable,``.py``
- Ruby [8]_,"up to 3.0.2",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"
+ Ruby [8]_,"up to 3.1",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"
TypeScript [9]_,"2.6-4.8",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
.. container:: footnote-group
diff --git a/docs/codeql/writing-codeql-queries/about-codeql-queries.rst b/docs/codeql/writing-codeql-queries/about-codeql-queries.rst
index 61d81bf6f3e..6dc9c126cec 100644
--- a/docs/codeql/writing-codeql-queries/about-codeql-queries.rst
+++ b/docs/codeql/writing-codeql-queries/about-codeql-queries.rst
@@ -47,15 +47,14 @@ Query metadata
Query metadata is used to identify your custom queries when they are added to the GitHub repository or used in your analysis. Metadata provides information about the query's purpose, and also specifies how to interpret and display the query results. For a full list of metadata properties, see ":doc:`Metadata for CodeQL queries `." The exact metadata requirement depends on how you are going to run your query:
- If you are contributing a query to the GitHub repository, please read the `query metadata style guide `__.
-- If you are adding a custom query to a query pack for analysis using LGTM , see `Writing custom queries to include in LGTM analysis `__.
- If you are analyzing a database using the :ref:`CodeQL CLI `, your query metadata must contain ``@kind``.
-- If you are running a query in the query console on LGTM or with the CodeQL extension for VS Code, metadata is not mandatory. However, if you want your results to be displayed as either an 'alert' or a 'path', you must specify the correct ``@kind`` property, as explained below. For more information, see `Using the query console `__ on LGTM.com and ":ref:`Analyzing your projects `" in the CodeQL for VS Code help.
+- If you are running a query with the CodeQL extension for VS Code, metadata is not mandatory. However, if you want your results to be displayed as either an 'alert' or a 'path', you must specify the correct ``@kind`` property, as explained below. For more information, see ":ref:`Analyzing your projects `" in the CodeQL for VS Code help.
.. pull-quote::
Note
- Queries that are contributed to the open source repository, added to a query pack in LGTM, or used to analyze a database with the :ref:`CodeQL CLI ` must have a query type (``@kind``) specified. The ``@kind`` property indicates how to interpret and display the results of the query analysis:
+ Queries that are contributed to the open source repository, or used to analyze a database with the :ref:`CodeQL CLI ` must have a query type (``@kind``) specified. The ``@kind`` property indicates how to interpret and display the results of the query analysis:
- Alert query metadata must contain ``@kind problem`` to identify the results as a simple alert.
- Path query metadata must contain ``@kind path-problem`` to identify the results as an alert documented by a sequence of code locations.
@@ -70,14 +69,16 @@ Import statements
Each query generally contains one or more ``import`` statements, which define the :ref:`libraries ` or :ref:`modules ` to import into the query. Libraries and modules provide a way of grouping together related :ref:`types `, :ref:`predicates `, and other modules. The contents of each library or module that you import can then be accessed by the query.
Our `open source repository on GitHub `__ contains the standard CodeQL libraries for each supported language.
-When writing your own alert queries, you would typically import the standard library for the language of the project that you are querying, using ``import`` followed by a language:
+When writing your own alert queries, you would typically import the standard library for the language of the project that you are querying. For more information about importing the standard CodeQL libraries, see the CodeQL library guides:
-- C/C++: ``cpp``
-- C#: ``csharp``
-- Go: ``go``
-- Java: ``java``
-- JavaScript/TypeScript: ``javascript``
-- Python: ``python``
+- :ref:`CodeQL library guide for C and C++ `
+- :ref:`CodeQL library guide for C# `
+- :ref:`CodeQL library guide for Go `
+- :ref:`CodeQL library guide for Java `
+- :ref:`CodeQL library guide for JavaScript `
+- :ref:`CodeQL library guide for Python `
+- :ref:`CodeQL library guide for Ruby `
+- :ref:`CodeQL library guide for TypeScript `
There are also libraries containing commonly used predicates, types, and other modules associated with different analyses, including data flow, control flow, and taint-tracking. In order to calculate path graphs, path queries require you to import a data flow library into the query file. For more information, see ":doc:`Creating path queries `."
@@ -129,7 +130,7 @@ Contributing queries
********************
Contributions to the standard queries and libraries are very welcome. For more information, see our `contributing guidelines `__.
-If you are contributing a query to the open source GitHub repository, writing a custom query for LGTM, or using a custom query in an analysis with the CodeQL CLI, then you need to include extra metadata in your query to ensure that the query results are interpreted and displayed correctly. See the following topics for more information on query metadata:
+If you are contributing a query to the open source GitHub repository or using a custom query in an analysis with the CodeQL CLI, then you need to include extra metadata in your query to ensure that the query results are interpreted and displayed correctly. See the following topics for more information on query metadata:
- ":doc:`Metadata for CodeQL queries `"
- `Query metadata style guide on GitHub `__
diff --git a/docs/codeql/writing-codeql-queries/creating-path-queries.rst b/docs/codeql/writing-codeql-queries/creating-path-queries.rst
index c41b67d427c..3be8823470c 100644
--- a/docs/codeql/writing-codeql-queries/creating-path-queries.rst
+++ b/docs/codeql/writing-codeql-queries/creating-path-queries.rst
@@ -18,7 +18,7 @@ This topic provides information on how to structure a path query file so you can
Note
- The alerts generated by path queries are displayed by default in `LGTM `__ and included in the results generated using the :ref:`CodeQL CLI `. You can also view the path explanations generated by your path query `directly in LGTM `__ or in the CodeQL :ref:`extension for VS Code `.
+ The alerts generated by path queries are included in the results generated using the :ref:`CodeQL CLI ` and in `code scanning `__. You can also view the path explanations generated by your path query in the :ref:`CodeQL extension for VS Code `.
To learn more about modeling data flow with CodeQL, see ":doc:`About data flow analysis `."
@@ -155,7 +155,7 @@ Select clauses for path queries consist of four 'columns', with the following st
select element, source, sink, string
The ``element`` and ``string`` columns represent the location of the alert and the alert message respectively, as explained in ":doc:`About CodeQL queries `." The second and third columns, ``source`` and ``sink``, are nodes on the path graph selected by the query.
-Each result generated by your query is displayed at a single location in the same way as an alert query. Additionally, each result also has an associated path, which can be viewed in LGTM or in the :ref:`CodeQL extension for VS Code `.
+Each result generated by your query is displayed at a single location in the same way as an alert query. Additionally, each result also has an associated path, which can be viewed in the :ref:`CodeQL extension for VS Code `.
The ``element`` that you select in the first column depends on the purpose of the query and the type of issue that it is designed to find. This is particularly important for security issues. For example, if you believe the ``source`` value to be globally invalid or malicious it may be best to display the alert at the ``source``. In contrast, you should consider displaying the alert at the ``sink`` if you believe it is the element that requires sanitization.
diff --git a/docs/codeql/writing-codeql-queries/query-help-files.rst b/docs/codeql/writing-codeql-queries/query-help-files.rst
index 60c37fce84f..3dffae2185c 100644
--- a/docs/codeql/writing-codeql-queries/query-help-files.rst
+++ b/docs/codeql/writing-codeql-queries/query-help-files.rst
@@ -16,10 +16,7 @@ For more information about how to write useful query help in a style that is con
You can access the query help for CodeQL queries by visiting `CodeQL query help `__.
You can also access the raw query help files in the `GitHub repository `__.
For example, see the `JavaScript security queries `__ and `C/C++ critical queries `__.
-
- For queries run by default on LGTM, there are several different ways to access the query help. For further information, see `Where do I see the query help for a query on LGTM? `__ in the LGTM user help.
-
-
+
Overview
========
diff --git a/go/ql/lib/CHANGELOG.md b/go/ql/lib/CHANGELOG.md
index 1f851cdf663..c38ebde0723 100644
--- a/go/ql/lib/CHANGELOG.md
+++ b/go/ql/lib/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.3.1
+
+### Minor Analysis Improvements
+
+* Added support for `BeegoInput.RequestBody` as a source of untrusted data.
+
## 0.3.0
### Deprecated APIs
diff --git a/go/ql/lib/change-notes/released/0.3.1.md b/go/ql/lib/change-notes/released/0.3.1.md
new file mode 100644
index 00000000000..be16eed5d3e
--- /dev/null
+++ b/go/ql/lib/change-notes/released/0.3.1.md
@@ -0,0 +1,5 @@
+## 0.3.1
+
+### Minor Analysis Improvements
+
+* Added support for `BeegoInput.RequestBody` as a source of untrusted data.
diff --git a/go/ql/lib/codeql-pack.release.yml b/go/ql/lib/codeql-pack.release.yml
index 95f6e3a0ba6..bb106b1cb63 100644
--- a/go/ql/lib/codeql-pack.release.yml
+++ b/go/ql/lib/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 0.3.0
+lastReleaseVersion: 0.3.1
diff --git a/go/ql/lib/qlpack.yml b/go/ql/lib/qlpack.yml
index 8025056129c..3b38291ebb5 100644
--- a/go/ql/lib/qlpack.yml
+++ b/go/ql/lib/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/go-all
-version: 0.3.1-dev
+version: 0.3.2-dev
groups: go
dbscheme: go.dbscheme
extractor: go
diff --git a/go/ql/lib/semmle/go/frameworks/Beego.qll b/go/ql/lib/semmle/go/frameworks/Beego.qll
index 6d927112584..85334e83ab8 100644
--- a/go/ql/lib/semmle/go/frameworks/Beego.qll
+++ b/go/ql/lib/semmle/go/frameworks/Beego.qll
@@ -103,6 +103,17 @@ module Beego {
}
}
+ /**
+ * `BeegoInputRequestBody` sources of untrusted data.
+ */
+ private class BeegoInputRequestBodySource extends UntrustedFlowSource::Range {
+ BeegoInputRequestBodySource() {
+ exists(DataFlow::FieldReadNode frn | this = frn |
+ frn.getField().hasQualifiedName(contextPackagePath(), "BeegoInput", "RequestBody")
+ )
+ }
+ }
+
/**
* `beego/context.Context` sources of untrusted data.
*/
diff --git a/go/ql/lib/semmle/go/security/InsecureRandomnessCustomizations.qll b/go/ql/lib/semmle/go/security/InsecureRandomnessCustomizations.qll
index 2cbb350461b..3bc6b5f5eec 100644
--- a/go/ql/lib/semmle/go/security/InsecureRandomnessCustomizations.qll
+++ b/go/ql/lib/semmle/go/security/InsecureRandomnessCustomizations.qll
@@ -64,7 +64,7 @@ module InsecureRandomness {
)
}
- override string getKind() { result = "this cryptographic algorithm" }
+ override string getKind() { result = "This cryptographic algorithm" }
}
/**
@@ -75,7 +75,7 @@ module InsecureRandomness {
this.getRoot().(FuncDef).getName().regexpMatch("(?i).*(gen(erate)?|salt|make|mk)Password.*")
}
- override string getKind() { result = "a password-related function" }
+ override string getKind() { result = "A password-related function" }
}
/** Gets a package that implements hash algorithms. */
diff --git a/go/ql/src/CHANGELOG.md b/go/ql/src/CHANGELOG.md
index 47dabdb2d2e..68880b18281 100644
--- a/go/ql/src/CHANGELOG.md
+++ b/go/ql/src/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.3.1
+
+No user-facing changes.
+
## 0.3.0
### Query Metadata Changes
diff --git a/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql b/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
index e3b725f4fdd..e0ba130ed19 100644
--- a/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
+++ b/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
@@ -3,6 +3,7 @@
* @name Successfully analyzed files
* @description List all files that were successfully extracted.
* @kind diagnostic
+ * @tags successfully-extracted-files
*/
import go
diff --git a/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql b/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
index c846ef16303..93889b0a23e 100644
--- a/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
+++ b/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
@@ -61,4 +61,4 @@ where
// }
n = DataFlow::BarrierGuard::getABarrierNode()
)
-select n, "The first argument to 'errors.Wrap' is always nil"
+select n, "The first argument to 'errors.Wrap' is always nil."
diff --git a/go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql b/go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql
index 71ae1ac183a..5c1b4528302 100644
--- a/go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql
+++ b/go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql
@@ -48,5 +48,5 @@ class Config extends DataFlow::Configuration {
from Config c, DataFlow::PathNode source, DataFlow::PathNode sink, string report
where c.hasFlowPath(source, sink) and c.isSource(source.getNode(), report)
-select source, source, sink, "$@ that is $@ contains " + report, source, "A string literal", sink,
+select source, source, sink, "This string literal that is $@ contains " + report, sink,
"used as a regular expression"
diff --git a/go/ql/src/Security/CWE-117/LogInjection.ql b/go/ql/src/Security/CWE-117/LogInjection.ql
index 070788af884..dbf0c767bb3 100644
--- a/go/ql/src/Security/CWE-117/LogInjection.ql
+++ b/go/ql/src/Security/CWE-117/LogInjection.ql
@@ -17,5 +17,5 @@ import DataFlow::PathGraph
from LogInjection::Configuration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
-select sink.getNode(), source, sink, "Log entry depends on a $@.", source.getNode(),
+select sink.getNode(), source, sink, "This log entry depends on a $@.", source.getNode(),
"user-provided value"
diff --git a/go/ql/src/Security/CWE-322/InsecureHostKeyCallback.qhelp b/go/ql/src/Security/CWE-322/InsecureHostKeyCallback.qhelp
index 02fa1e6bc8d..ce4872fa66c 100644
--- a/go/ql/src/Security/CWE-322/InsecureHostKeyCallback.qhelp
+++ b/go/ql/src/Security/CWE-322/InsecureHostKeyCallback.qhelp
@@ -30,7 +30,7 @@ When the allow list contains only a single host key then the function Fixe
-The following example shows the use of InsecureIgnoreHostKey and an insecure host key callback implemention commonly used in non-production code.
+The following example shows the use of InsecureIgnoreHostKey and an insecure host key callback implementation commonly used in non-production code.
diff --git a/go/ql/src/Security/CWE-338/InsecureRandomness.ql b/go/ql/src/Security/CWE-338/InsecureRandomness.ql
index 37ec1c21655..e87bbbae37b 100644
--- a/go/ql/src/Security/CWE-338/InsecureRandomness.ql
+++ b/go/ql/src/Security/CWE-338/InsecureRandomness.ql
@@ -19,7 +19,7 @@ where
cfg.hasFlowPath(source, sink) and
cfg.isSink(sink.getNode(), kind) and
(
- kind != "a password-related function"
+ kind != "A password-related function"
or
sink =
min(DataFlow::PathNode sink2, int line |
@@ -31,5 +31,5 @@ where
)
)
select sink.getNode(), source, sink,
- "$@ generated with a cryptographically weak RNG is used in $@.", source.getNode(),
- "A random number", sink.getNode(), kind
+ kind + " depends on a $@ generated with a cryptographically weak RNG.", source.getNode(),
+ "random number"
diff --git a/cpp/ql/src/change-notes/2022-09-23-alert-messages.md b/go/ql/src/change-notes/2022-10-07-alert-messages.md
similarity index 100%
rename from cpp/ql/src/change-notes/2022-09-23-alert-messages.md
rename to go/ql/src/change-notes/2022-10-07-alert-messages.md
diff --git a/go/ql/src/change-notes/released/0.3.1.md b/go/ql/src/change-notes/released/0.3.1.md
new file mode 100644
index 00000000000..9fd4efd6c80
--- /dev/null
+++ b/go/ql/src/change-notes/released/0.3.1.md
@@ -0,0 +1,3 @@
+## 0.3.1
+
+No user-facing changes.
diff --git a/go/ql/src/codeql-pack.release.yml b/go/ql/src/codeql-pack.release.yml
index 95f6e3a0ba6..bb106b1cb63 100644
--- a/go/ql/src/codeql-pack.release.yml
+++ b/go/ql/src/codeql-pack.release.yml
@@ -1,2 +1,2 @@
---
-lastReleaseVersion: 0.3.0
+lastReleaseVersion: 0.3.1
diff --git a/go/ql/src/experimental/CWE-321/HardcodedKeys.qhelp b/go/ql/src/experimental/CWE-321/HardcodedKeys.qhelp
index b641cbda184..ddbb4572eae 100644
--- a/go/ql/src/experimental/CWE-321/HardcodedKeys.qhelp
+++ b/go/ql/src/experimental/CWE-321/HardcodedKeys.qhelp
@@ -18,7 +18,7 @@
- Generating a cryptograhically secure secret key during application initialization and using this generated key for future JWT signing requests can prevent this vulnerability.
+ Generating a cryptographically secure secret key during application initialization and using this generated key for future JWT signing requests can prevent this vulnerability.
diff --git a/go/ql/src/experimental/CWE-369/DivideByZero.qhelp b/go/ql/src/experimental/CWE-369/DivideByZero.qhelp
index ae39d1df890..dc5cb2cf205 100644
--- a/go/ql/src/experimental/CWE-369/DivideByZero.qhelp
+++ b/go/ql/src/experimental/CWE-369/DivideByZero.qhelp
@@ -18,7 +18,7 @@ possibly causing a divide-by-zero panic.
-This can be fixed by testing the divisor against against zero:
+This can be fixed by testing the divisor against zero:
diff --git a/go/ql/src/experimental/CWE-369/DivideByZero.ql b/go/ql/src/experimental/CWE-369/DivideByZero.ql
index 8aa12f7f66e..b2e61bef37d 100644
--- a/go/ql/src/experimental/CWE-369/DivideByZero.ql
+++ b/go/ql/src/experimental/CWE-369/DivideByZero.ql
@@ -54,5 +54,4 @@ class DivideByZeroCheckConfig extends TaintTracking::Configuration {
from DataFlow::PathNode source, DataFlow::PathNode sink, DivideByZeroCheckConfig cfg
where cfg.hasFlowPath(source, sink)
-select sink, source, sink, "Variable $@ might be zero leading to a division-by-zero panic.", sink,
- sink.getNode().toString()
+select sink, source, sink, "This variable might be zero leading to a division-by-zero panic."
diff --git a/go/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql b/go/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql
index 253d598835d..66fb90664ea 100644
--- a/go/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql
+++ b/go/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql
@@ -66,4 +66,4 @@ query predicate edges(CallGraphNode pred, CallGraphNode succ) {
from LoopStmt loop, DatabaseAccess dbAccess
where edges*(loop, dbAccess.asExpr())
-select dbAccess, loop, dbAccess, "$@ is called in $@", dbAccess, dbAccess.toString(), loop, "a loop"
+select dbAccess, loop, dbAccess, "This calls " + dbAccess.toString() + " in a $@.", loop, "loop"
diff --git a/go/ql/src/experimental/CWE-918/SSRF.qhelp b/go/ql/src/experimental/CWE-918/SSRF.qhelp
index 7eeeabb68f6..ea37350698e 100644
--- a/go/ql/src/experimental/CWE-918/SSRF.qhelp
+++ b/go/ql/src/experimental/CWE-918/SSRF.qhelp
@@ -14,7 +14,7 @@ server side request forgery attacks, where the attacker controls the request tar
To guard against server side request forgery, it is advisable to avoid putting user input directly into a
network request. If using user input is necessary, then it must be validated. It is recommended to only allow
-user input consisting of alphanumeric characters. Simply URL-encoding other chracters is not always a solution,
+user input consisting of alphanumeric characters. Simply URL-encoding other characters is not always a solution,
for example because a downstream entity that is itself vulnerable may decode again before forwarding the request.
diff --git a/go/ql/src/experimental/CWE-918/SSRF.ql b/go/ql/src/experimental/CWE-918/SSRF.ql
index 41c41bb18de..4c14969c35f 100644
--- a/go/ql/src/experimental/CWE-918/SSRF.ql
+++ b/go/ql/src/experimental/CWE-918/SSRF.ql
@@ -19,4 +19,4 @@ from
where
cfg.hasFlowPath(source, sink) and
request = sink.getNode().(ServerSideRequestForgery::Sink).getARequest()
-select request, source, sink, "The URL of this request depends on a user-provided value"
+select request, source, sink, "The URL of this request depends on a user-provided value."
diff --git a/go/ql/src/experimental/IntegerOverflow/IntegerOverflow.ql b/go/ql/src/experimental/IntegerOverflow/IntegerOverflow.ql
index 3a3c6b1d745..ca17228816c 100644
--- a/go/ql/src/experimental/IntegerOverflow/IntegerOverflow.ql
+++ b/go/ql/src/experimental/IntegerOverflow/IntegerOverflow.ql
@@ -11,4 +11,4 @@ import RangeAnalysis
from Expr expr
where exprMayOverflow(expr) or exprMayUnderflow(expr)
-select expr, "this expression may cause an integer overflow"
+select expr, "This expression may cause an integer overflow."
diff --git a/go/ql/src/qlpack.yml b/go/ql/src/qlpack.yml
index f454b5ce9d9..574b63f69c1 100644
--- a/go/ql/src/qlpack.yml
+++ b/go/ql/src/qlpack.yml
@@ -1,5 +1,5 @@
name: codeql/go-queries
-version: 0.3.1-dev
+version: 0.3.2-dev
groups:
- go
- queries
diff --git a/go/ql/test/experimental/CWE-369/DivideByZero.expected b/go/ql/test/experimental/CWE-369/DivideByZero.expected
index 35a3e399cb7..e80e3295c22 100644
--- a/go/ql/test/experimental/CWE-369/DivideByZero.expected
+++ b/go/ql/test/experimental/CWE-369/DivideByZero.expected
@@ -24,9 +24,9 @@ nodes
| DivideByZero.go:57:17:57:21 | value | semmle.label | value |
subpaths
#select
-| DivideByZero.go:12:16:12:20 | value | DivideByZero.go:10:12:10:16 | selection of URL : pointer type | DivideByZero.go:12:16:12:20 | value | Variable $@ might be zero leading to a division-by-zero panic. | DivideByZero.go:12:16:12:20 | value | value |
-| DivideByZero.go:19:16:19:20 | value | DivideByZero.go:17:12:17:16 | selection of URL : pointer type | DivideByZero.go:19:16:19:20 | value | Variable $@ might be zero leading to a division-by-zero panic. | DivideByZero.go:19:16:19:20 | value | value |
-| DivideByZero.go:26:16:26:20 | value | DivideByZero.go:24:12:24:16 | selection of URL : pointer type | DivideByZero.go:26:16:26:20 | value | Variable $@ might be zero leading to a division-by-zero panic. | DivideByZero.go:26:16:26:20 | value | value |
-| DivideByZero.go:33:16:33:20 | value | DivideByZero.go:31:12:31:16 | selection of URL : pointer type | DivideByZero.go:33:16:33:20 | value | Variable $@ might be zero leading to a division-by-zero panic. | DivideByZero.go:33:16:33:20 | value | value |
-| DivideByZero.go:40:16:40:20 | value | DivideByZero.go:38:12:38:16 | selection of URL : pointer type | DivideByZero.go:40:16:40:20 | value | Variable $@ might be zero leading to a division-by-zero panic. | DivideByZero.go:40:16:40:20 | value | value |
-| DivideByZero.go:57:17:57:21 | value | DivideByZero.go:54:12:54:16 | selection of URL : pointer type | DivideByZero.go:57:17:57:21 | value | Variable $@ might be zero leading to a division-by-zero panic. | DivideByZero.go:57:17:57:21 | value | value |
+| DivideByZero.go:12:16:12:20 | value | DivideByZero.go:10:12:10:16 | selection of URL : pointer type | DivideByZero.go:12:16:12:20 | value | This variable might be zero leading to a division-by-zero panic. |
+| DivideByZero.go:19:16:19:20 | value | DivideByZero.go:17:12:17:16 | selection of URL : pointer type | DivideByZero.go:19:16:19:20 | value | This variable might be zero leading to a division-by-zero panic. |
+| DivideByZero.go:26:16:26:20 | value | DivideByZero.go:24:12:24:16 | selection of URL : pointer type | DivideByZero.go:26:16:26:20 | value | This variable might be zero leading to a division-by-zero panic. |
+| DivideByZero.go:33:16:33:20 | value | DivideByZero.go:31:12:31:16 | selection of URL : pointer type | DivideByZero.go:33:16:33:20 | value | This variable might be zero leading to a division-by-zero panic. |
+| DivideByZero.go:40:16:40:20 | value | DivideByZero.go:38:12:38:16 | selection of URL : pointer type | DivideByZero.go:40:16:40:20 | value | This variable might be zero leading to a division-by-zero panic. |
+| DivideByZero.go:57:17:57:21 | value | DivideByZero.go:54:12:54:16 | selection of URL : pointer type | DivideByZero.go:57:17:57:21 | value | This variable might be zero leading to a division-by-zero panic. |
diff --git a/go/ql/test/experimental/CWE-400/DatabaseCallInLoop.expected b/go/ql/test/experimental/CWE-400/DatabaseCallInLoop.expected
index bb197203f22..074dfaa134f 100644
--- a/go/ql/test/experimental/CWE-400/DatabaseCallInLoop.expected
+++ b/go/ql/test/experimental/CWE-400/DatabaseCallInLoop.expected
@@ -8,6 +8,6 @@ edges
| test.go:24:2:26:2 | for statement | test.go:25:3:25:17 | call to runRunQuery |
| test.go:25:3:25:17 | call to runRunQuery | test.go:14:1:16:1 | function declaration |
#select
-| DatabaseCallInLoop.go:9:3:9:41 | call to First | DatabaseCallInLoop.go:7:2:11:2 | range statement | DatabaseCallInLoop.go:9:3:9:41 | call to First | $@ is called in $@ | DatabaseCallInLoop.go:9:3:9:41 | call to First | call to First | DatabaseCallInLoop.go:7:2:11:2 | range statement | a loop |
-| test.go:11:2:11:13 | call to Take | test.go:20:2:22:2 | for statement | test.go:11:2:11:13 | call to Take | $@ is called in $@ | test.go:11:2:11:13 | call to Take | call to Take | test.go:20:2:22:2 | for statement | a loop |
-| test.go:11:2:11:13 | call to Take | test.go:24:2:26:2 | for statement | test.go:11:2:11:13 | call to Take | $@ is called in $@ | test.go:11:2:11:13 | call to Take | call to Take | test.go:24:2:26:2 | for statement | a loop |
+| DatabaseCallInLoop.go:9:3:9:41 | call to First | DatabaseCallInLoop.go:7:2:11:2 | range statement | DatabaseCallInLoop.go:9:3:9:41 | call to First | This calls call to First in a $@. | DatabaseCallInLoop.go:7:2:11:2 | range statement | loop |
+| test.go:11:2:11:13 | call to Take | test.go:20:2:22:2 | for statement | test.go:11:2:11:13 | call to Take | This calls call to Take in a $@. | test.go:20:2:22:2 | for statement | loop |
+| test.go:11:2:11:13 | call to Take | test.go:24:2:26:2 | for statement | test.go:11:2:11:13 | call to Take | This calls call to Take in a $@. | test.go:24:2:26:2 | for statement | loop |
diff --git a/go/ql/test/experimental/CWE-918/SSRF.expected b/go/ql/test/experimental/CWE-918/SSRF.expected
index a0b9993a4ca..5fdd1775d3d 100644
--- a/go/ql/test/experimental/CWE-918/SSRF.expected
+++ b/go/ql/test/experimental/CWE-918/SSRF.expected
@@ -55,20 +55,20 @@ nodes
| new-tests.go:96:11:96:46 | ...+... | semmle.label | ...+... |
subpaths
#select
-| builtin.go:22:12:22:63 | call to Get | builtin.go:19:12:19:34 | call to FormValue : string | builtin.go:22:21:22:62 | ...+... | The URL of this request depends on a user-provided value |
-| builtin.go:88:12:88:53 | call to Dial | builtin.go:83:21:83:31 | call to Referer : string | builtin.go:88:27:88:40 | untrustedInput | The URL of this request depends on a user-provided value |
-| builtin.go:102:13:102:40 | call to DialConfig | builtin.go:97:21:97:31 | call to Referer : string | builtin.go:101:36:101:49 | untrustedInput | The URL of this request depends on a user-provided value |
-| builtin.go:114:3:114:39 | call to Dial | builtin.go:111:21:111:31 | call to Referer : string | builtin.go:114:15:114:28 | untrustedInput | The URL of this request depends on a user-provided value |
-| builtin.go:132:3:132:62 | call to DialContext | builtin.go:129:21:129:31 | call to Referer : string | builtin.go:132:38:132:51 | untrustedInput | The URL of this request depends on a user-provided value |
-| new-tests.go:31:2:31:58 | call to Get | new-tests.go:26:26:26:30 | &... : pointer type | new-tests.go:31:11:31:57 | call to Sprintf | The URL of this request depends on a user-provided value |
-| new-tests.go:32:2:32:58 | call to Get | new-tests.go:26:26:26:30 | &... : pointer type | new-tests.go:32:11:32:57 | call to Sprintf | The URL of this request depends on a user-provided value |
-| new-tests.go:35:3:35:59 | call to Get | new-tests.go:26:26:26:30 | &... : pointer type | new-tests.go:35:12:35:58 | call to Sprintf | The URL of this request depends on a user-provided value |
-| new-tests.go:47:2:47:47 | call to Get | new-tests.go:39:18:39:30 | call to Param : string | new-tests.go:47:11:47:46 | ...+... | The URL of this request depends on a user-provided value |
-| new-tests.go:50:2:50:47 | call to Get | new-tests.go:49:18:49:30 | call to Query : string | new-tests.go:50:11:50:46 | ...+... | The URL of this request depends on a user-provided value |
-| new-tests.go:68:2:68:58 | call to Get | new-tests.go:62:31:62:38 | selection of Body : ReadCloser | new-tests.go:68:11:68:57 | call to Sprintf | The URL of this request depends on a user-provided value |
-| new-tests.go:69:2:69:58 | call to Get | new-tests.go:62:31:62:38 | selection of Body : ReadCloser | new-tests.go:69:11:69:57 | call to Sprintf | The URL of this request depends on a user-provided value |
-| new-tests.go:74:3:74:59 | call to Get | new-tests.go:62:31:62:38 | selection of Body : ReadCloser | new-tests.go:74:12:74:58 | call to Sprintf | The URL of this request depends on a user-provided value |
-| new-tests.go:79:2:79:47 | call to Get | new-tests.go:78:18:78:24 | selection of URL : pointer type | new-tests.go:79:11:79:46 | ...+... | The URL of this request depends on a user-provided value |
-| new-tests.go:82:2:82:47 | call to Get | new-tests.go:81:37:81:43 | selection of URL : pointer type | new-tests.go:82:11:82:46 | ...+... | The URL of this request depends on a user-provided value |
-| new-tests.go:88:2:88:47 | call to Get | new-tests.go:86:10:86:20 | call to Vars : map type | new-tests.go:88:11:88:46 | ...+... | The URL of this request depends on a user-provided value |
-| new-tests.go:96:2:96:47 | call to Get | new-tests.go:95:18:95:45 | call to URLParam : string | new-tests.go:96:11:96:46 | ...+... | The URL of this request depends on a user-provided value |
+| builtin.go:22:12:22:63 | call to Get | builtin.go:19:12:19:34 | call to FormValue : string | builtin.go:22:21:22:62 | ...+... | The URL of this request depends on a user-provided value. |
+| builtin.go:88:12:88:53 | call to Dial | builtin.go:83:21:83:31 | call to Referer : string | builtin.go:88:27:88:40 | untrustedInput | The URL of this request depends on a user-provided value. |
+| builtin.go:102:13:102:40 | call to DialConfig | builtin.go:97:21:97:31 | call to Referer : string | builtin.go:101:36:101:49 | untrustedInput | The URL of this request depends on a user-provided value. |
+| builtin.go:114:3:114:39 | call to Dial | builtin.go:111:21:111:31 | call to Referer : string | builtin.go:114:15:114:28 | untrustedInput | The URL of this request depends on a user-provided value. |
+| builtin.go:132:3:132:62 | call to DialContext | builtin.go:129:21:129:31 | call to Referer : string | builtin.go:132:38:132:51 | untrustedInput | The URL of this request depends on a user-provided value. |
+| new-tests.go:31:2:31:58 | call to Get | new-tests.go:26:26:26:30 | &... : pointer type | new-tests.go:31:11:31:57 | call to Sprintf | The URL of this request depends on a user-provided value. |
+| new-tests.go:32:2:32:58 | call to Get | new-tests.go:26:26:26:30 | &... : pointer type | new-tests.go:32:11:32:57 | call to Sprintf | The URL of this request depends on a user-provided value. |
+| new-tests.go:35:3:35:59 | call to Get | new-tests.go:26:26:26:30 | &... : pointer type | new-tests.go:35:12:35:58 | call to Sprintf | The URL of this request depends on a user-provided value. |
+| new-tests.go:47:2:47:47 | call to Get | new-tests.go:39:18:39:30 | call to Param : string | new-tests.go:47:11:47:46 | ...+... | The URL of this request depends on a user-provided value. |
+| new-tests.go:50:2:50:47 | call to Get | new-tests.go:49:18:49:30 | call to Query : string | new-tests.go:50:11:50:46 | ...+... | The URL of this request depends on a user-provided value. |
+| new-tests.go:68:2:68:58 | call to Get | new-tests.go:62:31:62:38 | selection of Body : ReadCloser | new-tests.go:68:11:68:57 | call to Sprintf | The URL of this request depends on a user-provided value. |
+| new-tests.go:69:2:69:58 | call to Get | new-tests.go:62:31:62:38 | selection of Body : ReadCloser | new-tests.go:69:11:69:57 | call to Sprintf | The URL of this request depends on a user-provided value. |
+| new-tests.go:74:3:74:59 | call to Get | new-tests.go:62:31:62:38 | selection of Body : ReadCloser | new-tests.go:74:12:74:58 | call to Sprintf | The URL of this request depends on a user-provided value. |
+| new-tests.go:79:2:79:47 | call to Get | new-tests.go:78:18:78:24 | selection of URL : pointer type | new-tests.go:79:11:79:46 | ...+... | The URL of this request depends on a user-provided value. |
+| new-tests.go:82:2:82:47 | call to Get | new-tests.go:81:37:81:43 | selection of URL : pointer type | new-tests.go:82:11:82:46 | ...+... | The URL of this request depends on a user-provided value. |
+| new-tests.go:88:2:88:47 | call to Get | new-tests.go:86:10:86:20 | call to Vars : map type | new-tests.go:88:11:88:46 | ...+... | The URL of this request depends on a user-provided value. |
+| new-tests.go:96:2:96:47 | call to Get | new-tests.go:95:18:95:45 | call to URLParam : string | new-tests.go:96:11:96:46 | ...+... | The URL of this request depends on a user-provided value. |
diff --git a/go/ql/test/experimental/CWE-942/CorsMisconfiguration.go b/go/ql/test/experimental/CWE-942/CorsMisconfiguration.go
index cac752dbcb2..5e6bf92ddcf 100644
--- a/go/ql/test/experimental/CWE-942/CorsMisconfiguration.go
+++ b/go/ql/test/experimental/CWE-942/CorsMisconfiguration.go
@@ -120,7 +120,7 @@ func main() {
}
})
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
- // OK-ish: the input origin header is validated agains a whitelist.
+ // OK-ish: the input origin header is validated against a whitelist.
responseHeader := w.Header()
{
origin := req.Header.Get("origin")
@@ -137,7 +137,7 @@ func main() {
})
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
originSuffix := ".example.com"
- // OK-ish: the input origin header is validated agains a suffix.
+ // OK-ish: the input origin header is validated against a suffix.
origin := req.Header.Get("Origin")
if origin != "" && (originSuffix == "" || strings.HasSuffix(origin, originSuffix)) {
w.Header().Set("Access-Control-Allow-Origin", origin)
@@ -152,7 +152,7 @@ func main() {
})
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
originSuffix := ".example.com"
- // OK-ish: the input origin header is validated agains a whitelist.
+ // OK-ish: the input origin header is validated against a whitelist.
origin := req.Header.Get("Origin")
if origin != "" && (originSuffix == "" || AccessControlAllowOrigins[origin]) {
w.Header().Set("Access-Control-Allow-Origin", origin)
@@ -166,7 +166,7 @@ func main() {
}
})
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
- // OK-ish: the input origin header is validated agains a whitelist.
+ // OK-ish: the input origin header is validated against a whitelist.
origin := req.Header.Get("origin")
if origin != "" && origin != "null" {
if len(AccessControlAllowOrigins) == 0 || AccessControlAllowOrigins[origin] {
@@ -178,7 +178,7 @@ func main() {
}
})
// http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
- // // OK-ish: the input origin header is validated agains a whitelist.
+ // // OK-ish: the input origin header is validated against a whitelist.
// origin := req.Header.Get("origin")
// if origin != "" && origin != "null" {
// if _, ok := AccessControlAllowOrigins[origin]; ok {
@@ -190,7 +190,7 @@ func main() {
// }
// })
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
- // OK-ish: the input origin header is validated agains a whitelist.
+ // OK-ish: the input origin header is validated against a whitelist.
if origin := req.Header.Get("Origin"); cors[origin] {
w.Header().Set("Access-Control-Allow-Origin", origin)
} else if len(origin) > 0 && cors["*"] {
@@ -202,7 +202,7 @@ func main() {
w.Header().Set("Access-Control-Allow-Credentials", "true")
})
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
- // OK-ish: the input origin header is validated agains a whitelist.
+ // OK-ish: the input origin header is validated against a whitelist.
origin := req.Header.Get("origin")
for _, v := range GetAllowOrigin() {
if v == origin {
diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Beego/CleartextLogging.expected b/go/ql/test/library-tests/semmle/go/frameworks/Beego/CleartextLogging.expected
index 6056f572d7c..11e51609b05 100644
--- a/go/ql/test/library-tests/semmle/go/frameworks/Beego/CleartextLogging.expected
+++ b/go/ql/test/library-tests/semmle/go/frameworks/Beego/CleartextLogging.expected
@@ -1,72 +1,72 @@
edges
nodes
-| test.go:147:14:147:21 | password | semmle.label | password |
-| test.go:148:17:148:24 | password | semmle.label | password |
-| test.go:149:14:149:21 | password | semmle.label | password |
-| test.go:150:18:150:25 | password | semmle.label | password |
-| test.go:151:14:151:21 | password | semmle.label | password |
-| test.go:152:13:152:20 | password | semmle.label | password |
-| test.go:153:22:153:29 | password | semmle.label | password |
-| test.go:154:15:154:22 | password | semmle.label | password |
-| test.go:155:14:155:21 | password | semmle.label | password |
-| test.go:156:13:156:20 | password | semmle.label | password |
-| test.go:157:16:157:23 | password | semmle.label | password |
-| test.go:158:13:158:20 | password | semmle.label | password |
-| test.go:159:16:159:23 | password | semmle.label | password |
-| test.go:160:13:160:20 | password | semmle.label | password |
-| test.go:161:17:161:24 | password | semmle.label | password |
-| test.go:162:13:162:20 | password | semmle.label | password |
-| test.go:163:12:163:19 | password | semmle.label | password |
-| test.go:164:21:164:28 | password | semmle.label | password |
-| test.go:165:14:165:21 | password | semmle.label | password |
-| test.go:166:13:166:20 | password | semmle.label | password |
-| test.go:167:12:167:19 | password | semmle.label | password |
-| test.go:168:15:168:22 | password | semmle.label | password |
+| test.go:148:14:148:21 | password | semmle.label | password |
+| test.go:149:17:149:24 | password | semmle.label | password |
+| test.go:150:14:150:21 | password | semmle.label | password |
+| test.go:151:18:151:25 | password | semmle.label | password |
+| test.go:152:14:152:21 | password | semmle.label | password |
+| test.go:153:13:153:20 | password | semmle.label | password |
+| test.go:154:22:154:29 | password | semmle.label | password |
+| test.go:155:15:155:22 | password | semmle.label | password |
+| test.go:156:14:156:21 | password | semmle.label | password |
+| test.go:157:13:157:20 | password | semmle.label | password |
+| test.go:158:16:158:23 | password | semmle.label | password |
+| test.go:159:13:159:20 | password | semmle.label | password |
+| test.go:160:16:160:23 | password | semmle.label | password |
+| test.go:161:13:161:20 | password | semmle.label | password |
+| test.go:162:17:162:24 | password | semmle.label | password |
+| test.go:163:13:163:20 | password | semmle.label | password |
+| test.go:164:12:164:19 | password | semmle.label | password |
+| test.go:165:21:165:28 | password | semmle.label | password |
+| test.go:166:14:166:21 | password | semmle.label | password |
+| test.go:167:13:167:20 | password | semmle.label | password |
+| test.go:168:12:168:19 | password | semmle.label | password |
| test.go:169:15:169:22 | password | semmle.label | password |
-| test.go:170:18:170:25 | password | semmle.label | password |
-| test.go:171:15:171:22 | password | semmle.label | password |
-| test.go:172:19:172:26 | password | semmle.label | password |
-| test.go:173:15:173:22 | password | semmle.label | password |
-| test.go:174:14:174:21 | password | semmle.label | password |
-| test.go:175:23:175:30 | password | semmle.label | password |
-| test.go:176:16:176:23 | password | semmle.label | password |
-| test.go:177:15:177:22 | password | semmle.label | password |
-| test.go:178:14:178:21 | password | semmle.label | password |
-| test.go:179:17:179:24 | password | semmle.label | password |
-| test.go:180:16:180:23 | password | semmle.label | password |
+| test.go:170:15:170:22 | password | semmle.label | password |
+| test.go:171:18:171:25 | password | semmle.label | password |
+| test.go:172:15:172:22 | password | semmle.label | password |
+| test.go:173:19:173:26 | password | semmle.label | password |
+| test.go:174:15:174:22 | password | semmle.label | password |
+| test.go:175:14:175:21 | password | semmle.label | password |
+| test.go:176:23:176:30 | password | semmle.label | password |
+| test.go:177:16:177:23 | password | semmle.label | password |
+| test.go:178:15:178:22 | password | semmle.label | password |
+| test.go:179:14:179:21 | password | semmle.label | password |
+| test.go:180:17:180:24 | password | semmle.label | password |
+| test.go:181:16:181:23 | password | semmle.label | password |
subpaths
#select
-| test.go:147:14:147:21 | password | test.go:147:14:147:21 | password | test.go:147:14:147:21 | password | $@ flows to a logging call. | test.go:147:14:147:21 | password | Sensitive data returned by an access to password |
-| test.go:148:17:148:24 | password | test.go:148:17:148:24 | password | test.go:148:17:148:24 | password | $@ flows to a logging call. | test.go:148:17:148:24 | password | Sensitive data returned by an access to password |
-| test.go:149:14:149:21 | password | test.go:149:14:149:21 | password | test.go:149:14:149:21 | password | $@ flows to a logging call. | test.go:149:14:149:21 | password | Sensitive data returned by an access to password |
-| test.go:150:18:150:25 | password | test.go:150:18:150:25 | password | test.go:150:18:150:25 | password | $@ flows to a logging call. | test.go:150:18:150:25 | password | Sensitive data returned by an access to password |
-| test.go:151:14:151:21 | password | test.go:151:14:151:21 | password | test.go:151:14:151:21 | password | $@ flows to a logging call. | test.go:151:14:151:21 | password | Sensitive data returned by an access to password |
-| test.go:152:13:152:20 | password | test.go:152:13:152:20 | password | test.go:152:13:152:20 | password | $@ flows to a logging call. | test.go:152:13:152:20 | password | Sensitive data returned by an access to password |
-| test.go:153:22:153:29 | password | test.go:153:22:153:29 | password | test.go:153:22:153:29 | password | $@ flows to a logging call. | test.go:153:22:153:29 | password | Sensitive data returned by an access to password |
-| test.go:154:15:154:22 | password | test.go:154:15:154:22 | password | test.go:154:15:154:22 | password | $@ flows to a logging call. | test.go:154:15:154:22 | password | Sensitive data returned by an access to password |
-| test.go:155:14:155:21 | password | test.go:155:14:155:21 | password | test.go:155:14:155:21 | password | $@ flows to a logging call. | test.go:155:14:155:21 | password | Sensitive data returned by an access to password |
-| test.go:156:13:156:20 | password | test.go:156:13:156:20 | password | test.go:156:13:156:20 | password | $@ flows to a logging call. | test.go:156:13:156:20 | password | Sensitive data returned by an access to password |
-| test.go:157:16:157:23 | password | test.go:157:16:157:23 | password | test.go:157:16:157:23 | password | $@ flows to a logging call. | test.go:157:16:157:23 | password | Sensitive data returned by an access to password |
-| test.go:158:13:158:20 | password | test.go:158:13:158:20 | password | test.go:158:13:158:20 | password | $@ flows to a logging call. | test.go:158:13:158:20 | password | Sensitive data returned by an access to password |
-| test.go:159:16:159:23 | password | test.go:159:16:159:23 | password | test.go:159:16:159:23 | password | $@ flows to a logging call. | test.go:159:16:159:23 | password | Sensitive data returned by an access to password |
-| test.go:160:13:160:20 | password | test.go:160:13:160:20 | password | test.go:160:13:160:20 | password | $@ flows to a logging call. | test.go:160:13:160:20 | password | Sensitive data returned by an access to password |
-| test.go:161:17:161:24 | password | test.go:161:17:161:24 | password | test.go:161:17:161:24 | password | $@ flows to a logging call. | test.go:161:17:161:24 | password | Sensitive data returned by an access to password |
-| test.go:162:13:162:20 | password | test.go:162:13:162:20 | password | test.go:162:13:162:20 | password | $@ flows to a logging call. | test.go:162:13:162:20 | password | Sensitive data returned by an access to password |
-| test.go:163:12:163:19 | password | test.go:163:12:163:19 | password | test.go:163:12:163:19 | password | $@ flows to a logging call. | test.go:163:12:163:19 | password | Sensitive data returned by an access to password |
-| test.go:164:21:164:28 | password | test.go:164:21:164:28 | password | test.go:164:21:164:28 | password | $@ flows to a logging call. | test.go:164:21:164:28 | password | Sensitive data returned by an access to password |
-| test.go:165:14:165:21 | password | test.go:165:14:165:21 | password | test.go:165:14:165:21 | password | $@ flows to a logging call. | test.go:165:14:165:21 | password | Sensitive data returned by an access to password |
-| test.go:166:13:166:20 | password | test.go:166:13:166:20 | password | test.go:166:13:166:20 | password | $@ flows to a logging call. | test.go:166:13:166:20 | password | Sensitive data returned by an access to password |
-| test.go:167:12:167:19 | password | test.go:167:12:167:19 | password | test.go:167:12:167:19 | password | $@ flows to a logging call. | test.go:167:12:167:19 | password | Sensitive data returned by an access to password |
-| test.go:168:15:168:22 | password | test.go:168:15:168:22 | password | test.go:168:15:168:22 | password | $@ flows to a logging call. | test.go:168:15:168:22 | password | Sensitive data returned by an access to password |
+| test.go:148:14:148:21 | password | test.go:148:14:148:21 | password | test.go:148:14:148:21 | password | $@ flows to a logging call. | test.go:148:14:148:21 | password | Sensitive data returned by an access to password |
+| test.go:149:17:149:24 | password | test.go:149:17:149:24 | password | test.go:149:17:149:24 | password | $@ flows to a logging call. | test.go:149:17:149:24 | password | Sensitive data returned by an access to password |
+| test.go:150:14:150:21 | password | test.go:150:14:150:21 | password | test.go:150:14:150:21 | password | $@ flows to a logging call. | test.go:150:14:150:21 | password | Sensitive data returned by an access to password |
+| test.go:151:18:151:25 | password | test.go:151:18:151:25 | password | test.go:151:18:151:25 | password | $@ flows to a logging call. | test.go:151:18:151:25 | password | Sensitive data returned by an access to password |
+| test.go:152:14:152:21 | password | test.go:152:14:152:21 | password | test.go:152:14:152:21 | password | $@ flows to a logging call. | test.go:152:14:152:21 | password | Sensitive data returned by an access to password |
+| test.go:153:13:153:20 | password | test.go:153:13:153:20 | password | test.go:153:13:153:20 | password | $@ flows to a logging call. | test.go:153:13:153:20 | password | Sensitive data returned by an access to password |
+| test.go:154:22:154:29 | password | test.go:154:22:154:29 | password | test.go:154:22:154:29 | password | $@ flows to a logging call. | test.go:154:22:154:29 | password | Sensitive data returned by an access to password |
+| test.go:155:15:155:22 | password | test.go:155:15:155:22 | password | test.go:155:15:155:22 | password | $@ flows to a logging call. | test.go:155:15:155:22 | password | Sensitive data returned by an access to password |
+| test.go:156:14:156:21 | password | test.go:156:14:156:21 | password | test.go:156:14:156:21 | password | $@ flows to a logging call. | test.go:156:14:156:21 | password | Sensitive data returned by an access to password |
+| test.go:157:13:157:20 | password | test.go:157:13:157:20 | password | test.go:157:13:157:20 | password | $@ flows to a logging call. | test.go:157:13:157:20 | password | Sensitive data returned by an access to password |
+| test.go:158:16:158:23 | password | test.go:158:16:158:23 | password | test.go:158:16:158:23 | password | $@ flows to a logging call. | test.go:158:16:158:23 | password | Sensitive data returned by an access to password |
+| test.go:159:13:159:20 | password | test.go:159:13:159:20 | password | test.go:159:13:159:20 | password | $@ flows to a logging call. | test.go:159:13:159:20 | password | Sensitive data returned by an access to password |
+| test.go:160:16:160:23 | password | test.go:160:16:160:23 | password | test.go:160:16:160:23 | password | $@ flows to a logging call. | test.go:160:16:160:23 | password | Sensitive data returned by an access to password |
+| test.go:161:13:161:20 | password | test.go:161:13:161:20 | password | test.go:161:13:161:20 | password | $@ flows to a logging call. | test.go:161:13:161:20 | password | Sensitive data returned by an access to password |
+| test.go:162:17:162:24 | password | test.go:162:17:162:24 | password | test.go:162:17:162:24 | password | $@ flows to a logging call. | test.go:162:17:162:24 | password | Sensitive data returned by an access to password |
+| test.go:163:13:163:20 | password | test.go:163:13:163:20 | password | test.go:163:13:163:20 | password | $@ flows to a logging call. | test.go:163:13:163:20 | password | Sensitive data returned by an access to password |
+| test.go:164:12:164:19 | password | test.go:164:12:164:19 | password | test.go:164:12:164:19 | password | $@ flows to a logging call. | test.go:164:12:164:19 | password | Sensitive data returned by an access to password |
+| test.go:165:21:165:28 | password | test.go:165:21:165:28 | password | test.go:165:21:165:28 | password | $@ flows to a logging call. | test.go:165:21:165:28 | password | Sensitive data returned by an access to password |
+| test.go:166:14:166:21 | password | test.go:166:14:166:21 | password | test.go:166:14:166:21 | password | $@ flows to a logging call. | test.go:166:14:166:21 | password | Sensitive data returned by an access to password |
+| test.go:167:13:167:20 | password | test.go:167:13:167:20 | password | test.go:167:13:167:20 | password | $@ flows to a logging call. | test.go:167:13:167:20 | password | Sensitive data returned by an access to password |
+| test.go:168:12:168:19 | password | test.go:168:12:168:19 | password | test.go:168:12:168:19 | password | $@ flows to a logging call. | test.go:168:12:168:19 | password | Sensitive data returned by an access to password |
| test.go:169:15:169:22 | password | test.go:169:15:169:22 | password | test.go:169:15:169:22 | password | $@ flows to a logging call. | test.go:169:15:169:22 | password | Sensitive data returned by an access to password |
-| test.go:170:18:170:25 | password | test.go:170:18:170:25 | password | test.go:170:18:170:25 | password | $@ flows to a logging call. | test.go:170:18:170:25 | password | Sensitive data returned by an access to password |
-| test.go:171:15:171:22 | password | test.go:171:15:171:22 | password | test.go:171:15:171:22 | password | $@ flows to a logging call. | test.go:171:15:171:22 | password | Sensitive data returned by an access to password |
-| test.go:172:19:172:26 | password | test.go:172:19:172:26 | password | test.go:172:19:172:26 | password | $@ flows to a logging call. | test.go:172:19:172:26 | password | Sensitive data returned by an access to password |
-| test.go:173:15:173:22 | password | test.go:173:15:173:22 | password | test.go:173:15:173:22 | password | $@ flows to a logging call. | test.go:173:15:173:22 | password | Sensitive data returned by an access to password |
-| test.go:174:14:174:21 | password | test.go:174:14:174:21 | password | test.go:174:14:174:21 | password | $@ flows to a logging call. | test.go:174:14:174:21 | password | Sensitive data returned by an access to password |
-| test.go:175:23:175:30 | password | test.go:175:23:175:30 | password | test.go:175:23:175:30 | password | $@ flows to a logging call. | test.go:175:23:175:30 | password | Sensitive data returned by an access to password |
-| test.go:176:16:176:23 | password | test.go:176:16:176:23 | password | test.go:176:16:176:23 | password | $@ flows to a logging call. | test.go:176:16:176:23 | password | Sensitive data returned by an access to password |
-| test.go:177:15:177:22 | password | test.go:177:15:177:22 | password | test.go:177:15:177:22 | password | $@ flows to a logging call. | test.go:177:15:177:22 | password | Sensitive data returned by an access to password |
-| test.go:178:14:178:21 | password | test.go:178:14:178:21 | password | test.go:178:14:178:21 | password | $@ flows to a logging call. | test.go:178:14:178:21 | password | Sensitive data returned by an access to password |
-| test.go:179:17:179:24 | password | test.go:179:17:179:24 | password | test.go:179:17:179:24 | password | $@ flows to a logging call. | test.go:179:17:179:24 | password | Sensitive data returned by an access to password |
-| test.go:180:16:180:23 | password | test.go:180:16:180:23 | password | test.go:180:16:180:23 | password | $@ flows to a logging call. | test.go:180:16:180:23 | password | Sensitive data returned by an access to password |
+| test.go:170:15:170:22 | password | test.go:170:15:170:22 | password | test.go:170:15:170:22 | password | $@ flows to a logging call. | test.go:170:15:170:22 | password | Sensitive data returned by an access to password |
+| test.go:171:18:171:25 | password | test.go:171:18:171:25 | password | test.go:171:18:171:25 | password | $@ flows to a logging call. | test.go:171:18:171:25 | password | Sensitive data returned by an access to password |
+| test.go:172:15:172:22 | password | test.go:172:15:172:22 | password | test.go:172:15:172:22 | password | $@ flows to a logging call. | test.go:172:15:172:22 | password | Sensitive data returned by an access to password |
+| test.go:173:19:173:26 | password | test.go:173:19:173:26 | password | test.go:173:19:173:26 | password | $@ flows to a logging call. | test.go:173:19:173:26 | password | Sensitive data returned by an access to password |
+| test.go:174:15:174:22 | password | test.go:174:15:174:22 | password | test.go:174:15:174:22 | password | $@ flows to a logging call. | test.go:174:15:174:22 | password | Sensitive data returned by an access to password |
+| test.go:175:14:175:21 | password | test.go:175:14:175:21 | password | test.go:175:14:175:21 | password | $@ flows to a logging call. | test.go:175:14:175:21 | password | Sensitive data returned by an access to password |
+| test.go:176:23:176:30 | password | test.go:176:23:176:30 | password | test.go:176:23:176:30 | password | $@ flows to a logging call. | test.go:176:23:176:30 | password | Sensitive data returned by an access to password |
+| test.go:177:16:177:23 | password | test.go:177:16:177:23 | password | test.go:177:16:177:23 | password | $@ flows to a logging call. | test.go:177:16:177:23 | password | Sensitive data returned by an access to password |
+| test.go:178:15:178:22 | password | test.go:178:15:178:22 | password | test.go:178:15:178:22 | password | $@ flows to a logging call. | test.go:178:15:178:22 | password | Sensitive data returned by an access to password |
+| test.go:179:14:179:21 | password | test.go:179:14:179:21 | password | test.go:179:14:179:21 | password | $@ flows to a logging call. | test.go:179:14:179:21 | password | Sensitive data returned by an access to password |
+| test.go:180:17:180:24 | password | test.go:180:17:180:24 | password | test.go:180:17:180:24 | password | $@ flows to a logging call. | test.go:180:17:180:24 | password | Sensitive data returned by an access to password |
+| test.go:181:16:181:23 | password | test.go:181:16:181:23 | password | test.go:181:16:181:23 | password | $@ flows to a logging call. | test.go:181:16:181:23 | password | Sensitive data returned by an access to password |
diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Beego/OpenRedirect.expected b/go/ql/test/library-tests/semmle/go/frameworks/Beego/OpenRedirect.expected
index ff1902aa72a..9a80d4698cc 100644
--- a/go/ql/test/library-tests/semmle/go/frameworks/Beego/OpenRedirect.expected
+++ b/go/ql/test/library-tests/semmle/go/frameworks/Beego/OpenRedirect.expected
@@ -1,12 +1,12 @@
edges
nodes
-| test.go:246:13:246:34 | call to GetString | semmle.label | call to GetString |
-| test.go:247:20:247:41 | call to GetString | semmle.label | call to GetString |
-| test.go:310:13:310:27 | call to URI | semmle.label | call to URI |
-| test.go:310:13:310:27 | call to URI | semmle.label | call to URI |
-| test.go:311:20:311:34 | call to URL | semmle.label | call to URL |
-| test.go:311:20:311:34 | call to URL | semmle.label | call to URL |
+| test.go:247:13:247:34 | call to GetString | semmle.label | call to GetString |
+| test.go:248:20:248:41 | call to GetString | semmle.label | call to GetString |
+| test.go:311:13:311:27 | call to URI | semmle.label | call to URI |
+| test.go:311:13:311:27 | call to URI | semmle.label | call to URI |
+| test.go:312:20:312:34 | call to URL | semmle.label | call to URL |
+| test.go:312:20:312:34 | call to URL | semmle.label | call to URL |
subpaths
#select
-| test.go:246:13:246:34 | call to GetString | test.go:246:13:246:34 | call to GetString | test.go:246:13:246:34 | call to GetString | Untrusted URL redirection depends on a $@. | test.go:246:13:246:34 | call to GetString | user-provided value |
-| test.go:247:20:247:41 | call to GetString | test.go:247:20:247:41 | call to GetString | test.go:247:20:247:41 | call to GetString | Untrusted URL redirection depends on a $@. | test.go:247:20:247:41 | call to GetString | user-provided value |
+| test.go:247:13:247:34 | call to GetString | test.go:247:13:247:34 | call to GetString | test.go:247:13:247:34 | call to GetString | Untrusted URL redirection depends on a $@. | test.go:247:13:247:34 | call to GetString | user-provided value |
+| test.go:248:20:248:41 | call to GetString | test.go:248:20:248:41 | call to GetString | test.go:248:20:248:41 | call to GetString | Untrusted URL redirection depends on a $@. | test.go:248:20:248:41 | call to GetString | user-provided value |
diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Beego/ReflectedXss.expected b/go/ql/test/library-tests/semmle/go/frameworks/Beego/ReflectedXss.expected
index 2de1ce81fff..cb39cfdd247 100644
--- a/go/ql/test/library-tests/semmle/go/frameworks/Beego/ReflectedXss.expected
+++ b/go/ql/test/library-tests/semmle/go/frameworks/Beego/ReflectedXss.expected
@@ -1,317 +1,317 @@
edges
-| test.go:26:6:26:10 | definition of bound : bindMe | test.go:28:13:28:30 | type conversion |
-| test.go:26:6:26:10 | definition of bound : bindMe | test.go:28:20:28:26 | selection of a : slice type |
-| test.go:26:6:26:10 | definition of bound : bindMe | test.go:29:13:29:27 | type conversion |
-| test.go:26:6:26:10 | definition of bound : bindMe | test.go:30:13:30:29 | type conversion |
-| test.go:26:6:26:10 | definition of bound : bindMe | test.go:30:20:30:26 | selection of c : subBindMe |
-| test.go:28:20:28:26 | selection of a : slice type | test.go:28:13:28:30 | type conversion |
-| test.go:30:20:30:26 | selection of c : subBindMe | test.go:30:13:30:29 | type conversion |
-| test.go:35:20:35:42 | call to Cookie : string | test.go:35:13:35:43 | type conversion |
-| test.go:40:20:40:31 | call to Data : map type | test.go:40:13:40:52 | type conversion |
-| test.go:45:20:45:43 | call to GetData : basic interface type | test.go:45:13:45:53 | type conversion |
-| test.go:50:20:50:42 | call to Header : string | test.go:50:13:50:43 | type conversion |
-| test.go:55:20:55:41 | call to Param : string | test.go:55:13:55:42 | type conversion |
-| test.go:60:20:60:33 | call to Params : map type | test.go:60:13:60:45 | type conversion |
-| test.go:65:20:65:41 | call to Query : string | test.go:65:13:65:42 | type conversion |
-| test.go:70:20:70:32 | call to Refer : string | test.go:70:13:70:33 | type conversion |
-| test.go:75:20:75:34 | call to Referer : string | test.go:75:13:75:35 | type conversion |
-| test.go:80:20:80:30 | call to URI : string | test.go:80:13:80:31 | type conversion |
-| test.go:85:20:85:30 | call to URL : string | test.go:85:13:85:31 | type conversion |
-| test.go:90:20:90:36 | call to UserAgent : string | test.go:90:13:90:37 | type conversion |
-| test.go:95:14:95:25 | call to Data : map type | test.go:95:14:95:45 | type assertion |
-| test.go:107:14:107:25 | call to Data : map type | test.go:107:14:107:45 | type assertion |
-| test.go:119:14:119:25 | call to Data : map type | test.go:119:14:119:45 | type assertion |
-| test.go:136:23:136:42 | call to Data : map type | test.go:136:23:136:62 | type assertion |
-| test.go:192:15:192:26 | call to Data : map type | test.go:193:14:193:55 | type conversion |
-| test.go:192:15:192:26 | call to Data : map type | test.go:194:14:194:58 | type conversion |
-| test.go:192:15:192:26 | call to Data : map type | test.go:196:14:196:28 | type assertion |
-| test.go:192:15:192:26 | call to Data : map type | test.go:197:14:197:55 | type conversion |
-| test.go:192:15:192:26 | call to Data : map type | test.go:198:14:198:59 | type conversion |
-| test.go:201:18:201:33 | selection of Form : Values | test.go:202:14:202:28 | type conversion |
-| test.go:216:2:216:34 | ... := ...[0] : File | test.go:219:14:219:20 | content |
-| test.go:216:2:216:34 | ... := ...[1] : pointer type | test.go:217:14:217:32 | type conversion |
-| test.go:216:2:216:34 | ... := ...[1] : pointer type | test.go:217:21:217:22 | implicit dereference : FileHeader |
-| test.go:217:21:217:22 | implicit dereference : FileHeader | test.go:217:14:217:32 | type conversion |
-| test.go:217:21:217:22 | implicit dereference : FileHeader | test.go:217:21:217:22 | implicit dereference : FileHeader |
-| test.go:221:2:221:40 | ... := ...[0] : slice type | test.go:222:14:222:38 | type conversion |
-| test.go:221:2:221:40 | ... := ...[0] : slice type | test.go:222:21:222:28 | implicit dereference : FileHeader |
-| test.go:221:2:221:40 | ... := ...[0] : slice type | test.go:222:21:222:28 | index expression : pointer type |
-| test.go:222:21:222:28 | implicit dereference : FileHeader | test.go:222:14:222:38 | type conversion |
-| test.go:222:21:222:28 | implicit dereference : FileHeader | test.go:222:21:222:28 | implicit dereference : FileHeader |
-| test.go:222:21:222:28 | implicit dereference : FileHeader | test.go:222:21:222:28 | index expression : pointer type |
-| test.go:222:21:222:28 | index expression : pointer type | test.go:222:14:222:38 | type conversion |
-| test.go:222:21:222:28 | index expression : pointer type | test.go:222:21:222:28 | implicit dereference : FileHeader |
-| test.go:222:21:222:28 | index expression : pointer type | test.go:222:21:222:28 | index expression : pointer type |
-| test.go:224:7:224:28 | call to GetString : string | test.go:225:14:225:22 | type conversion |
-| test.go:227:8:227:35 | call to GetStrings : slice type | test.go:228:14:228:26 | type conversion |
-| test.go:230:9:230:17 | call to Input : Values | test.go:231:14:231:27 | type conversion |
-| test.go:233:6:233:8 | definition of str : myStruct | test.go:235:14:235:30 | type conversion |
-| test.go:239:15:239:36 | call to GetString : string | test.go:242:21:242:29 | untrusted |
-| test.go:252:23:252:44 | call to GetCookie : string | test.go:252:16:252:45 | type conversion |
-| test.go:263:62:263:83 | call to GetCookie : string | test.go:263:55:263:84 | type conversion |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:276:21:276:61 | call to GetDisplayString |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:276:44:276:51 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:276:44:276:51 | index expression : pointer type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:277:21:277:53 | call to SliceChunk : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:277:21:277:56 | index expression : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:277:21:277:83 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:277:21:277:92 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:278:21:278:60 | call to SliceDiff : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:278:21:278:87 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:278:21:278:96 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:283:3:285:44 | call to SliceFilter : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:283:3:285:71 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:283:3:285:80 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:286:21:286:65 | call to SliceIntersect : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:286:21:286:92 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:286:21:286:101 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:287:21:287:65 | call to SliceIntersect : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:287:21:287:92 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:287:21:287:101 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:288:21:288:61 | call to SliceMerge : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:288:21:288:88 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:288:21:288:97 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:289:21:289:61 | call to SliceMerge : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:289:21:289:88 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:289:21:289:97 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:290:21:290:66 | call to SlicePad : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:290:21:290:93 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:290:21:290:102 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:291:21:291:66 | call to SlicePad : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:291:21:291:93 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:291:21:291:102 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:292:21:292:73 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:292:21:292:82 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:294:21:294:97 | call to SliceReduce : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:294:21:294:124 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:294:21:294:133 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:295:21:295:52 | call to SliceShuffle : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:295:21:295:79 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:295:21:295:88 | selection of Filename |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:296:21:296:51 | call to SliceUnique : slice type |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:296:21:296:78 | implicit dereference : FileHeader |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:296:21:296:87 | selection of Filename |
-| test.go:276:44:276:51 | implicit dereference : FileHeader | test.go:276:21:276:61 | call to GetDisplayString |
-| test.go:276:44:276:51 | implicit dereference : FileHeader | test.go:276:44:276:51 | implicit dereference : FileHeader |
-| test.go:276:44:276:51 | implicit dereference : FileHeader | test.go:276:44:276:51 | index expression : pointer type |
-| test.go:276:44:276:51 | index expression : pointer type | test.go:276:21:276:61 | call to GetDisplayString |
-| test.go:276:44:276:51 | index expression : pointer type | test.go:276:44:276:51 | implicit dereference : FileHeader |
-| test.go:276:44:276:51 | index expression : pointer type | test.go:276:44:276:51 | index expression : pointer type |
-| test.go:277:21:277:53 | call to SliceChunk : slice type | test.go:277:21:277:56 | index expression : slice type |
-| test.go:277:21:277:53 | call to SliceChunk : slice type | test.go:277:21:277:83 | implicit dereference : FileHeader |
-| test.go:277:21:277:53 | call to SliceChunk : slice type | test.go:277:21:277:92 | selection of Filename |
-| test.go:277:21:277:56 | index expression : slice type | test.go:277:21:277:83 | implicit dereference : FileHeader |
-| test.go:277:21:277:56 | index expression : slice type | test.go:277:21:277:92 | selection of Filename |
-| test.go:277:21:277:83 | implicit dereference : FileHeader | test.go:277:21:277:92 | selection of Filename |
-| test.go:278:21:278:60 | call to SliceDiff : slice type | test.go:278:21:278:87 | implicit dereference : FileHeader |
-| test.go:278:21:278:60 | call to SliceDiff : slice type | test.go:278:21:278:96 | selection of Filename |
-| test.go:278:21:278:87 | implicit dereference : FileHeader | test.go:278:21:278:96 | selection of Filename |
-| test.go:283:3:285:44 | call to SliceFilter : slice type | test.go:283:3:285:71 | implicit dereference : FileHeader |
-| test.go:283:3:285:44 | call to SliceFilter : slice type | test.go:283:3:285:80 | selection of Filename |
-| test.go:283:3:285:71 | implicit dereference : FileHeader | test.go:283:3:285:80 | selection of Filename |
-| test.go:286:21:286:65 | call to SliceIntersect : slice type | test.go:286:21:286:92 | implicit dereference : FileHeader |
-| test.go:286:21:286:65 | call to SliceIntersect : slice type | test.go:286:21:286:101 | selection of Filename |
-| test.go:286:21:286:92 | implicit dereference : FileHeader | test.go:286:21:286:101 | selection of Filename |
+| test.go:27:6:27:10 | definition of bound : bindMe | test.go:29:13:29:30 | type conversion |
+| test.go:27:6:27:10 | definition of bound : bindMe | test.go:29:20:29:26 | selection of a : slice type |
+| test.go:27:6:27:10 | definition of bound : bindMe | test.go:30:13:30:27 | type conversion |
+| test.go:27:6:27:10 | definition of bound : bindMe | test.go:31:13:31:29 | type conversion |
+| test.go:27:6:27:10 | definition of bound : bindMe | test.go:31:20:31:26 | selection of c : subBindMe |
+| test.go:29:20:29:26 | selection of a : slice type | test.go:29:13:29:30 | type conversion |
+| test.go:31:20:31:26 | selection of c : subBindMe | test.go:31:13:31:29 | type conversion |
+| test.go:36:20:36:42 | call to Cookie : string | test.go:36:13:36:43 | type conversion |
+| test.go:41:20:41:31 | call to Data : map type | test.go:41:13:41:52 | type conversion |
+| test.go:46:20:46:43 | call to GetData : basic interface type | test.go:46:13:46:53 | type conversion |
+| test.go:51:20:51:42 | call to Header : string | test.go:51:13:51:43 | type conversion |
+| test.go:56:20:56:41 | call to Param : string | test.go:56:13:56:42 | type conversion |
+| test.go:61:20:61:33 | call to Params : map type | test.go:61:13:61:45 | type conversion |
+| test.go:66:20:66:41 | call to Query : string | test.go:66:13:66:42 | type conversion |
+| test.go:71:20:71:32 | call to Refer : string | test.go:71:13:71:33 | type conversion |
+| test.go:76:20:76:34 | call to Referer : string | test.go:76:13:76:35 | type conversion |
+| test.go:81:20:81:30 | call to URI : string | test.go:81:13:81:31 | type conversion |
+| test.go:86:20:86:30 | call to URL : string | test.go:86:13:86:31 | type conversion |
+| test.go:91:20:91:36 | call to UserAgent : string | test.go:91:13:91:37 | type conversion |
+| test.go:96:14:96:25 | call to Data : map type | test.go:96:14:96:45 | type assertion |
+| test.go:108:14:108:25 | call to Data : map type | test.go:108:14:108:45 | type assertion |
+| test.go:120:14:120:25 | call to Data : map type | test.go:120:14:120:45 | type assertion |
+| test.go:137:23:137:42 | call to Data : map type | test.go:137:23:137:62 | type assertion |
+| test.go:193:15:193:26 | call to Data : map type | test.go:194:14:194:55 | type conversion |
+| test.go:193:15:193:26 | call to Data : map type | test.go:195:14:195:58 | type conversion |
+| test.go:193:15:193:26 | call to Data : map type | test.go:197:14:197:28 | type assertion |
+| test.go:193:15:193:26 | call to Data : map type | test.go:198:14:198:55 | type conversion |
+| test.go:193:15:193:26 | call to Data : map type | test.go:199:14:199:59 | type conversion |
+| test.go:202:18:202:33 | selection of Form : Values | test.go:203:14:203:28 | type conversion |
+| test.go:217:2:217:34 | ... := ...[0] : File | test.go:220:14:220:20 | content |
+| test.go:217:2:217:34 | ... := ...[1] : pointer type | test.go:218:14:218:32 | type conversion |
+| test.go:217:2:217:34 | ... := ...[1] : pointer type | test.go:218:21:218:22 | implicit dereference : FileHeader |
+| test.go:218:21:218:22 | implicit dereference : FileHeader | test.go:218:14:218:32 | type conversion |
+| test.go:218:21:218:22 | implicit dereference : FileHeader | test.go:218:21:218:22 | implicit dereference : FileHeader |
+| test.go:222:2:222:40 | ... := ...[0] : slice type | test.go:223:14:223:38 | type conversion |
+| test.go:222:2:222:40 | ... := ...[0] : slice type | test.go:223:21:223:28 | implicit dereference : FileHeader |
+| test.go:222:2:222:40 | ... := ...[0] : slice type | test.go:223:21:223:28 | index expression : pointer type |
+| test.go:223:21:223:28 | implicit dereference : FileHeader | test.go:223:14:223:38 | type conversion |
+| test.go:223:21:223:28 | implicit dereference : FileHeader | test.go:223:21:223:28 | implicit dereference : FileHeader |
+| test.go:223:21:223:28 | implicit dereference : FileHeader | test.go:223:21:223:28 | index expression : pointer type |
+| test.go:223:21:223:28 | index expression : pointer type | test.go:223:14:223:38 | type conversion |
+| test.go:223:21:223:28 | index expression : pointer type | test.go:223:21:223:28 | implicit dereference : FileHeader |
+| test.go:223:21:223:28 | index expression : pointer type | test.go:223:21:223:28 | index expression : pointer type |
+| test.go:225:7:225:28 | call to GetString : string | test.go:226:14:226:22 | type conversion |
+| test.go:228:8:228:35 | call to GetStrings : slice type | test.go:229:14:229:26 | type conversion |
+| test.go:231:9:231:17 | call to Input : Values | test.go:232:14:232:27 | type conversion |
+| test.go:234:6:234:8 | definition of str : myStruct | test.go:236:14:236:30 | type conversion |
+| test.go:240:15:240:36 | call to GetString : string | test.go:243:21:243:29 | untrusted |
+| test.go:253:23:253:44 | call to GetCookie : string | test.go:253:16:253:45 | type conversion |
+| test.go:264:62:264:83 | call to GetCookie : string | test.go:264:55:264:84 | type conversion |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:277:21:277:61 | call to GetDisplayString |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:277:44:277:51 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:277:44:277:51 | index expression : pointer type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:278:21:278:53 | call to SliceChunk : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:278:21:278:56 | index expression : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:278:21:278:83 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:278:21:278:92 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:279:21:279:60 | call to SliceDiff : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:279:21:279:87 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:279:21:279:96 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:284:3:286:44 | call to SliceFilter : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:284:3:286:71 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:284:3:286:80 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:287:21:287:65 | call to SliceIntersect : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:287:21:287:92 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:287:21:287:101 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:288:21:288:65 | call to SliceIntersect : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:288:21:288:92 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:288:21:288:101 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:289:21:289:61 | call to SliceMerge : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:289:21:289:88 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:289:21:289:97 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:290:21:290:61 | call to SliceMerge : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:290:21:290:88 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:290:21:290:97 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:291:21:291:66 | call to SlicePad : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:291:21:291:93 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:291:21:291:102 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:292:21:292:66 | call to SlicePad : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:292:21:292:93 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:292:21:292:102 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:293:21:293:73 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:293:21:293:82 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:295:21:295:97 | call to SliceReduce : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:295:21:295:124 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:295:21:295:133 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:296:21:296:52 | call to SliceShuffle : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:296:21:296:79 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:296:21:296:88 | selection of Filename |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:297:21:297:51 | call to SliceUnique : slice type |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:297:21:297:78 | implicit dereference : FileHeader |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:297:21:297:87 | selection of Filename |
+| test.go:277:44:277:51 | implicit dereference : FileHeader | test.go:277:21:277:61 | call to GetDisplayString |
+| test.go:277:44:277:51 | implicit dereference : FileHeader | test.go:277:44:277:51 | implicit dereference : FileHeader |
+| test.go:277:44:277:51 | implicit dereference : FileHeader | test.go:277:44:277:51 | index expression : pointer type |
+| test.go:277:44:277:51 | index expression : pointer type | test.go:277:21:277:61 | call to GetDisplayString |
+| test.go:277:44:277:51 | index expression : pointer type | test.go:277:44:277:51 | implicit dereference : FileHeader |
+| test.go:277:44:277:51 | index expression : pointer type | test.go:277:44:277:51 | index expression : pointer type |
+| test.go:278:21:278:53 | call to SliceChunk : slice type | test.go:278:21:278:56 | index expression : slice type |
+| test.go:278:21:278:53 | call to SliceChunk : slice type | test.go:278:21:278:83 | implicit dereference : FileHeader |
+| test.go:278:21:278:53 | call to SliceChunk : slice type | test.go:278:21:278:92 | selection of Filename |
+| test.go:278:21:278:56 | index expression : slice type | test.go:278:21:278:83 | implicit dereference : FileHeader |
+| test.go:278:21:278:56 | index expression : slice type | test.go:278:21:278:92 | selection of Filename |
+| test.go:278:21:278:83 | implicit dereference : FileHeader | test.go:278:21:278:92 | selection of Filename |
+| test.go:279:21:279:60 | call to SliceDiff : slice type | test.go:279:21:279:87 | implicit dereference : FileHeader |
+| test.go:279:21:279:60 | call to SliceDiff : slice type | test.go:279:21:279:96 | selection of Filename |
+| test.go:279:21:279:87 | implicit dereference : FileHeader | test.go:279:21:279:96 | selection of Filename |
+| test.go:284:3:286:44 | call to SliceFilter : slice type | test.go:284:3:286:71 | implicit dereference : FileHeader |
+| test.go:284:3:286:44 | call to SliceFilter : slice type | test.go:284:3:286:80 | selection of Filename |
+| test.go:284:3:286:71 | implicit dereference : FileHeader | test.go:284:3:286:80 | selection of Filename |
| test.go:287:21:287:65 | call to SliceIntersect : slice type | test.go:287:21:287:92 | implicit dereference : FileHeader |
| test.go:287:21:287:65 | call to SliceIntersect : slice type | test.go:287:21:287:101 | selection of Filename |
| test.go:287:21:287:92 | implicit dereference : FileHeader | test.go:287:21:287:101 | selection of Filename |
-| test.go:288:21:288:61 | call to SliceMerge : slice type | test.go:288:21:288:88 | implicit dereference : FileHeader |
-| test.go:288:21:288:61 | call to SliceMerge : slice type | test.go:288:21:288:97 | selection of Filename |
-| test.go:288:21:288:88 | implicit dereference : FileHeader | test.go:288:21:288:97 | selection of Filename |
+| test.go:288:21:288:65 | call to SliceIntersect : slice type | test.go:288:21:288:92 | implicit dereference : FileHeader |
+| test.go:288:21:288:65 | call to SliceIntersect : slice type | test.go:288:21:288:101 | selection of Filename |
+| test.go:288:21:288:92 | implicit dereference : FileHeader | test.go:288:21:288:101 | selection of Filename |
| test.go:289:21:289:61 | call to SliceMerge : slice type | test.go:289:21:289:88 | implicit dereference : FileHeader |
| test.go:289:21:289:61 | call to SliceMerge : slice type | test.go:289:21:289:97 | selection of Filename |
| test.go:289:21:289:88 | implicit dereference : FileHeader | test.go:289:21:289:97 | selection of Filename |
-| test.go:290:21:290:66 | call to SlicePad : slice type | test.go:290:21:290:93 | implicit dereference : FileHeader |
-| test.go:290:21:290:66 | call to SlicePad : slice type | test.go:290:21:290:102 | selection of Filename |
-| test.go:290:21:290:93 | implicit dereference : FileHeader | test.go:290:21:290:102 | selection of Filename |
+| test.go:290:21:290:61 | call to SliceMerge : slice type | test.go:290:21:290:88 | implicit dereference : FileHeader |
+| test.go:290:21:290:61 | call to SliceMerge : slice type | test.go:290:21:290:97 | selection of Filename |
+| test.go:290:21:290:88 | implicit dereference : FileHeader | test.go:290:21:290:97 | selection of Filename |
| test.go:291:21:291:66 | call to SlicePad : slice type | test.go:291:21:291:93 | implicit dereference : FileHeader |
| test.go:291:21:291:66 | call to SlicePad : slice type | test.go:291:21:291:102 | selection of Filename |
| test.go:291:21:291:93 | implicit dereference : FileHeader | test.go:291:21:291:102 | selection of Filename |
-| test.go:292:21:292:73 | implicit dereference : FileHeader | test.go:292:21:292:82 | selection of Filename |
-| test.go:294:21:294:97 | call to SliceReduce : slice type | test.go:294:21:294:124 | implicit dereference : FileHeader |
-| test.go:294:21:294:97 | call to SliceReduce : slice type | test.go:294:21:294:133 | selection of Filename |
-| test.go:294:21:294:124 | implicit dereference : FileHeader | test.go:294:21:294:133 | selection of Filename |
-| test.go:295:21:295:52 | call to SliceShuffle : slice type | test.go:295:21:295:79 | implicit dereference : FileHeader |
-| test.go:295:21:295:52 | call to SliceShuffle : slice type | test.go:295:21:295:88 | selection of Filename |
-| test.go:295:21:295:79 | implicit dereference : FileHeader | test.go:295:21:295:88 | selection of Filename |
-| test.go:296:21:296:51 | call to SliceUnique : slice type | test.go:296:21:296:78 | implicit dereference : FileHeader |
-| test.go:296:21:296:51 | call to SliceUnique : slice type | test.go:296:21:296:87 | selection of Filename |
-| test.go:296:21:296:78 | implicit dereference : FileHeader | test.go:296:21:296:87 | selection of Filename |
-| test.go:302:15:302:36 | call to GetString : string | test.go:304:21:304:48 | type assertion |
-| test.go:302:15:302:36 | call to GetString : string | test.go:305:21:305:32 | call to Items : map type |
-| test.go:302:15:302:36 | call to GetString : string | test.go:305:21:305:52 | type assertion |
-| test.go:305:21:305:32 | call to Items : map type | test.go:305:21:305:52 | type assertion |
+| test.go:292:21:292:66 | call to SlicePad : slice type | test.go:292:21:292:93 | implicit dereference : FileHeader |
+| test.go:292:21:292:66 | call to SlicePad : slice type | test.go:292:21:292:102 | selection of Filename |
+| test.go:292:21:292:93 | implicit dereference : FileHeader | test.go:292:21:292:102 | selection of Filename |
+| test.go:293:21:293:73 | implicit dereference : FileHeader | test.go:293:21:293:82 | selection of Filename |
+| test.go:295:21:295:97 | call to SliceReduce : slice type | test.go:295:21:295:124 | implicit dereference : FileHeader |
+| test.go:295:21:295:97 | call to SliceReduce : slice type | test.go:295:21:295:133 | selection of Filename |
+| test.go:295:21:295:124 | implicit dereference : FileHeader | test.go:295:21:295:133 | selection of Filename |
+| test.go:296:21:296:52 | call to SliceShuffle : slice type | test.go:296:21:296:79 | implicit dereference : FileHeader |
+| test.go:296:21:296:52 | call to SliceShuffle : slice type | test.go:296:21:296:88 | selection of Filename |
+| test.go:296:21:296:79 | implicit dereference : FileHeader | test.go:296:21:296:88 | selection of Filename |
+| test.go:297:21:297:51 | call to SliceUnique : slice type | test.go:297:21:297:78 | implicit dereference : FileHeader |
+| test.go:297:21:297:51 | call to SliceUnique : slice type | test.go:297:21:297:87 | selection of Filename |
+| test.go:297:21:297:78 | implicit dereference : FileHeader | test.go:297:21:297:87 | selection of Filename |
+| test.go:303:15:303:36 | call to GetString : string | test.go:305:21:305:48 | type assertion |
+| test.go:303:15:303:36 | call to GetString : string | test.go:306:21:306:32 | call to Items : map type |
+| test.go:303:15:303:36 | call to GetString : string | test.go:306:21:306:52 | type assertion |
+| test.go:306:21:306:32 | call to Items : map type | test.go:306:21:306:52 | type assertion |
nodes
-| test.go:26:6:26:10 | definition of bound : bindMe | semmle.label | definition of bound : bindMe |
-| test.go:28:13:28:30 | type conversion | semmle.label | type conversion |
-| test.go:28:20:28:26 | selection of a : slice type | semmle.label | selection of a : slice type |
-| test.go:29:13:29:27 | type conversion | semmle.label | type conversion |
-| test.go:30:13:30:29 | type conversion | semmle.label | type conversion |
-| test.go:30:20:30:26 | selection of c : subBindMe | semmle.label | selection of c : subBindMe |
-| test.go:35:13:35:43 | type conversion | semmle.label | type conversion |
-| test.go:35:20:35:42 | call to Cookie : string | semmle.label | call to Cookie : string |
-| test.go:40:13:40:52 | type conversion | semmle.label | type conversion |
-| test.go:40:20:40:31 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:45:13:45:53 | type conversion | semmle.label | type conversion |
-| test.go:45:20:45:43 | call to GetData : basic interface type | semmle.label | call to GetData : basic interface type |
-| test.go:50:13:50:43 | type conversion | semmle.label | type conversion |
-| test.go:50:20:50:42 | call to Header : string | semmle.label | call to Header : string |
-| test.go:55:13:55:42 | type conversion | semmle.label | type conversion |
-| test.go:55:20:55:41 | call to Param : string | semmle.label | call to Param : string |
-| test.go:60:13:60:45 | type conversion | semmle.label | type conversion |
-| test.go:60:20:60:33 | call to Params : map type | semmle.label | call to Params : map type |
-| test.go:65:13:65:42 | type conversion | semmle.label | type conversion |
-| test.go:65:20:65:41 | call to Query : string | semmle.label | call to Query : string |
-| test.go:70:13:70:33 | type conversion | semmle.label | type conversion |
-| test.go:70:20:70:32 | call to Refer : string | semmle.label | call to Refer : string |
-| test.go:75:13:75:35 | type conversion | semmle.label | type conversion |
-| test.go:75:20:75:34 | call to Referer : string | semmle.label | call to Referer : string |
-| test.go:80:13:80:31 | type conversion | semmle.label | type conversion |
-| test.go:80:20:80:30 | call to URI : string | semmle.label | call to URI : string |
-| test.go:85:13:85:31 | type conversion | semmle.label | type conversion |
-| test.go:85:20:85:30 | call to URL : string | semmle.label | call to URL : string |
-| test.go:90:13:90:37 | type conversion | semmle.label | type conversion |
-| test.go:90:20:90:36 | call to UserAgent : string | semmle.label | call to UserAgent : string |
-| test.go:95:14:95:25 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:95:14:95:45 | type assertion | semmle.label | type assertion |
-| test.go:107:14:107:25 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:107:14:107:45 | type assertion | semmle.label | type assertion |
-| test.go:119:14:119:25 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:119:14:119:45 | type assertion | semmle.label | type assertion |
-| test.go:136:23:136:42 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:136:23:136:62 | type assertion | semmle.label | type assertion |
-| test.go:192:15:192:26 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:193:14:193:55 | type conversion | semmle.label | type conversion |
-| test.go:194:14:194:58 | type conversion | semmle.label | type conversion |
-| test.go:196:14:196:28 | type assertion | semmle.label | type assertion |
-| test.go:197:14:197:55 | type conversion | semmle.label | type conversion |
-| test.go:198:14:198:59 | type conversion | semmle.label | type conversion |
-| test.go:201:18:201:33 | selection of Form : Values | semmle.label | selection of Form : Values |
-| test.go:202:14:202:28 | type conversion | semmle.label | type conversion |
-| test.go:216:2:216:34 | ... := ...[0] : File | semmle.label | ... := ...[0] : File |
-| test.go:216:2:216:34 | ... := ...[1] : pointer type | semmle.label | ... := ...[1] : pointer type |
-| test.go:217:14:217:32 | type conversion | semmle.label | type conversion |
-| test.go:217:21:217:22 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:219:14:219:20 | content | semmle.label | content |
-| test.go:221:2:221:40 | ... := ...[0] : slice type | semmle.label | ... := ...[0] : slice type |
-| test.go:222:14:222:38 | type conversion | semmle.label | type conversion |
-| test.go:222:21:222:28 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:222:21:222:28 | index expression : pointer type | semmle.label | index expression : pointer type |
-| test.go:224:7:224:28 | call to GetString : string | semmle.label | call to GetString : string |
-| test.go:225:14:225:22 | type conversion | semmle.label | type conversion |
-| test.go:227:8:227:35 | call to GetStrings : slice type | semmle.label | call to GetStrings : slice type |
-| test.go:228:14:228:26 | type conversion | semmle.label | type conversion |
-| test.go:230:9:230:17 | call to Input : Values | semmle.label | call to Input : Values |
-| test.go:231:14:231:27 | type conversion | semmle.label | type conversion |
-| test.go:233:6:233:8 | definition of str : myStruct | semmle.label | definition of str : myStruct |
-| test.go:235:14:235:30 | type conversion | semmle.label | type conversion |
-| test.go:239:15:239:36 | call to GetString : string | semmle.label | call to GetString : string |
-| test.go:242:21:242:29 | untrusted | semmle.label | untrusted |
-| test.go:252:16:252:45 | type conversion | semmle.label | type conversion |
-| test.go:252:23:252:44 | call to GetCookie : string | semmle.label | call to GetCookie : string |
-| test.go:257:16:257:37 | call to GetCookie | semmle.label | call to GetCookie |
-| test.go:258:15:258:41 | call to GetCookie | semmle.label | call to GetCookie |
-| test.go:263:55:263:84 | type conversion | semmle.label | type conversion |
-| test.go:263:62:263:83 | call to GetCookie : string | semmle.label | call to GetCookie : string |
-| test.go:268:2:268:40 | ... := ...[0] : slice type | semmle.label | ... := ...[0] : slice type |
-| test.go:276:21:276:61 | call to GetDisplayString | semmle.label | call to GetDisplayString |
-| test.go:276:44:276:51 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:276:44:276:51 | index expression : pointer type | semmle.label | index expression : pointer type |
-| test.go:277:21:277:53 | call to SliceChunk : slice type | semmle.label | call to SliceChunk : slice type |
-| test.go:277:21:277:56 | index expression : slice type | semmle.label | index expression : slice type |
-| test.go:277:21:277:83 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:277:21:277:92 | selection of Filename | semmle.label | selection of Filename |
-| test.go:278:21:278:60 | call to SliceDiff : slice type | semmle.label | call to SliceDiff : slice type |
-| test.go:278:21:278:87 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:278:21:278:96 | selection of Filename | semmle.label | selection of Filename |
-| test.go:283:3:285:44 | call to SliceFilter : slice type | semmle.label | call to SliceFilter : slice type |
-| test.go:283:3:285:71 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:283:3:285:80 | selection of Filename | semmle.label | selection of Filename |
-| test.go:286:21:286:65 | call to SliceIntersect : slice type | semmle.label | call to SliceIntersect : slice type |
-| test.go:286:21:286:92 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:286:21:286:101 | selection of Filename | semmle.label | selection of Filename |
+| test.go:27:6:27:10 | definition of bound : bindMe | semmle.label | definition of bound : bindMe |
+| test.go:29:13:29:30 | type conversion | semmle.label | type conversion |
+| test.go:29:20:29:26 | selection of a : slice type | semmle.label | selection of a : slice type |
+| test.go:30:13:30:27 | type conversion | semmle.label | type conversion |
+| test.go:31:13:31:29 | type conversion | semmle.label | type conversion |
+| test.go:31:20:31:26 | selection of c : subBindMe | semmle.label | selection of c : subBindMe |
+| test.go:36:13:36:43 | type conversion | semmle.label | type conversion |
+| test.go:36:20:36:42 | call to Cookie : string | semmle.label | call to Cookie : string |
+| test.go:41:13:41:52 | type conversion | semmle.label | type conversion |
+| test.go:41:20:41:31 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:46:13:46:53 | type conversion | semmle.label | type conversion |
+| test.go:46:20:46:43 | call to GetData : basic interface type | semmle.label | call to GetData : basic interface type |
+| test.go:51:13:51:43 | type conversion | semmle.label | type conversion |
+| test.go:51:20:51:42 | call to Header : string | semmle.label | call to Header : string |
+| test.go:56:13:56:42 | type conversion | semmle.label | type conversion |
+| test.go:56:20:56:41 | call to Param : string | semmle.label | call to Param : string |
+| test.go:61:13:61:45 | type conversion | semmle.label | type conversion |
+| test.go:61:20:61:33 | call to Params : map type | semmle.label | call to Params : map type |
+| test.go:66:13:66:42 | type conversion | semmle.label | type conversion |
+| test.go:66:20:66:41 | call to Query : string | semmle.label | call to Query : string |
+| test.go:71:13:71:33 | type conversion | semmle.label | type conversion |
+| test.go:71:20:71:32 | call to Refer : string | semmle.label | call to Refer : string |
+| test.go:76:13:76:35 | type conversion | semmle.label | type conversion |
+| test.go:76:20:76:34 | call to Referer : string | semmle.label | call to Referer : string |
+| test.go:81:13:81:31 | type conversion | semmle.label | type conversion |
+| test.go:81:20:81:30 | call to URI : string | semmle.label | call to URI : string |
+| test.go:86:13:86:31 | type conversion | semmle.label | type conversion |
+| test.go:86:20:86:30 | call to URL : string | semmle.label | call to URL : string |
+| test.go:91:13:91:37 | type conversion | semmle.label | type conversion |
+| test.go:91:20:91:36 | call to UserAgent : string | semmle.label | call to UserAgent : string |
+| test.go:96:14:96:25 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:96:14:96:45 | type assertion | semmle.label | type assertion |
+| test.go:108:14:108:25 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:108:14:108:45 | type assertion | semmle.label | type assertion |
+| test.go:120:14:120:25 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:120:14:120:45 | type assertion | semmle.label | type assertion |
+| test.go:137:23:137:42 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:137:23:137:62 | type assertion | semmle.label | type assertion |
+| test.go:193:15:193:26 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:194:14:194:55 | type conversion | semmle.label | type conversion |
+| test.go:195:14:195:58 | type conversion | semmle.label | type conversion |
+| test.go:197:14:197:28 | type assertion | semmle.label | type assertion |
+| test.go:198:14:198:55 | type conversion | semmle.label | type conversion |
+| test.go:199:14:199:59 | type conversion | semmle.label | type conversion |
+| test.go:202:18:202:33 | selection of Form : Values | semmle.label | selection of Form : Values |
+| test.go:203:14:203:28 | type conversion | semmle.label | type conversion |
+| test.go:217:2:217:34 | ... := ...[0] : File | semmle.label | ... := ...[0] : File |
+| test.go:217:2:217:34 | ... := ...[1] : pointer type | semmle.label | ... := ...[1] : pointer type |
+| test.go:218:14:218:32 | type conversion | semmle.label | type conversion |
+| test.go:218:21:218:22 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:220:14:220:20 | content | semmle.label | content |
+| test.go:222:2:222:40 | ... := ...[0] : slice type | semmle.label | ... := ...[0] : slice type |
+| test.go:223:14:223:38 | type conversion | semmle.label | type conversion |
+| test.go:223:21:223:28 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:223:21:223:28 | index expression : pointer type | semmle.label | index expression : pointer type |
+| test.go:225:7:225:28 | call to GetString : string | semmle.label | call to GetString : string |
+| test.go:226:14:226:22 | type conversion | semmle.label | type conversion |
+| test.go:228:8:228:35 | call to GetStrings : slice type | semmle.label | call to GetStrings : slice type |
+| test.go:229:14:229:26 | type conversion | semmle.label | type conversion |
+| test.go:231:9:231:17 | call to Input : Values | semmle.label | call to Input : Values |
+| test.go:232:14:232:27 | type conversion | semmle.label | type conversion |
+| test.go:234:6:234:8 | definition of str : myStruct | semmle.label | definition of str : myStruct |
+| test.go:236:14:236:30 | type conversion | semmle.label | type conversion |
+| test.go:240:15:240:36 | call to GetString : string | semmle.label | call to GetString : string |
+| test.go:243:21:243:29 | untrusted | semmle.label | untrusted |
+| test.go:253:16:253:45 | type conversion | semmle.label | type conversion |
+| test.go:253:23:253:44 | call to GetCookie : string | semmle.label | call to GetCookie : string |
+| test.go:258:16:258:37 | call to GetCookie | semmle.label | call to GetCookie |
+| test.go:259:15:259:41 | call to GetCookie | semmle.label | call to GetCookie |
+| test.go:264:55:264:84 | type conversion | semmle.label | type conversion |
+| test.go:264:62:264:83 | call to GetCookie : string | semmle.label | call to GetCookie : string |
+| test.go:269:2:269:40 | ... := ...[0] : slice type | semmle.label | ... := ...[0] : slice type |
+| test.go:277:21:277:61 | call to GetDisplayString | semmle.label | call to GetDisplayString |
+| test.go:277:44:277:51 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:277:44:277:51 | index expression : pointer type | semmle.label | index expression : pointer type |
+| test.go:278:21:278:53 | call to SliceChunk : slice type | semmle.label | call to SliceChunk : slice type |
+| test.go:278:21:278:56 | index expression : slice type | semmle.label | index expression : slice type |
+| test.go:278:21:278:83 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:278:21:278:92 | selection of Filename | semmle.label | selection of Filename |
+| test.go:279:21:279:60 | call to SliceDiff : slice type | semmle.label | call to SliceDiff : slice type |
+| test.go:279:21:279:87 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:279:21:279:96 | selection of Filename | semmle.label | selection of Filename |
+| test.go:284:3:286:44 | call to SliceFilter : slice type | semmle.label | call to SliceFilter : slice type |
+| test.go:284:3:286:71 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:284:3:286:80 | selection of Filename | semmle.label | selection of Filename |
| test.go:287:21:287:65 | call to SliceIntersect : slice type | semmle.label | call to SliceIntersect : slice type |
| test.go:287:21:287:92 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
| test.go:287:21:287:101 | selection of Filename | semmle.label | selection of Filename |
-| test.go:288:21:288:61 | call to SliceMerge : slice type | semmle.label | call to SliceMerge : slice type |
-| test.go:288:21:288:88 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:288:21:288:97 | selection of Filename | semmle.label | selection of Filename |
+| test.go:288:21:288:65 | call to SliceIntersect : slice type | semmle.label | call to SliceIntersect : slice type |
+| test.go:288:21:288:92 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:288:21:288:101 | selection of Filename | semmle.label | selection of Filename |
| test.go:289:21:289:61 | call to SliceMerge : slice type | semmle.label | call to SliceMerge : slice type |
| test.go:289:21:289:88 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
| test.go:289:21:289:97 | selection of Filename | semmle.label | selection of Filename |
-| test.go:290:21:290:66 | call to SlicePad : slice type | semmle.label | call to SlicePad : slice type |
-| test.go:290:21:290:93 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:290:21:290:102 | selection of Filename | semmle.label | selection of Filename |
+| test.go:290:21:290:61 | call to SliceMerge : slice type | semmle.label | call to SliceMerge : slice type |
+| test.go:290:21:290:88 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:290:21:290:97 | selection of Filename | semmle.label | selection of Filename |
| test.go:291:21:291:66 | call to SlicePad : slice type | semmle.label | call to SlicePad : slice type |
| test.go:291:21:291:93 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
| test.go:291:21:291:102 | selection of Filename | semmle.label | selection of Filename |
-| test.go:292:21:292:73 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:292:21:292:82 | selection of Filename | semmle.label | selection of Filename |
-| test.go:294:21:294:97 | call to SliceReduce : slice type | semmle.label | call to SliceReduce : slice type |
-| test.go:294:21:294:124 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:294:21:294:133 | selection of Filename | semmle.label | selection of Filename |
-| test.go:295:21:295:52 | call to SliceShuffle : slice type | semmle.label | call to SliceShuffle : slice type |
-| test.go:295:21:295:79 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:295:21:295:88 | selection of Filename | semmle.label | selection of Filename |
-| test.go:296:21:296:51 | call to SliceUnique : slice type | semmle.label | call to SliceUnique : slice type |
-| test.go:296:21:296:78 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
-| test.go:296:21:296:87 | selection of Filename | semmle.label | selection of Filename |
-| test.go:302:15:302:36 | call to GetString : string | semmle.label | call to GetString : string |
-| test.go:304:21:304:48 | type assertion | semmle.label | type assertion |
-| test.go:305:21:305:32 | call to Items : map type | semmle.label | call to Items : map type |
-| test.go:305:21:305:52 | type assertion | semmle.label | type assertion |
+| test.go:292:21:292:66 | call to SlicePad : slice type | semmle.label | call to SlicePad : slice type |
+| test.go:292:21:292:93 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:292:21:292:102 | selection of Filename | semmle.label | selection of Filename |
+| test.go:293:21:293:73 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:293:21:293:82 | selection of Filename | semmle.label | selection of Filename |
+| test.go:295:21:295:97 | call to SliceReduce : slice type | semmle.label | call to SliceReduce : slice type |
+| test.go:295:21:295:124 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:295:21:295:133 | selection of Filename | semmle.label | selection of Filename |
+| test.go:296:21:296:52 | call to SliceShuffle : slice type | semmle.label | call to SliceShuffle : slice type |
+| test.go:296:21:296:79 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:296:21:296:88 | selection of Filename | semmle.label | selection of Filename |
+| test.go:297:21:297:51 | call to SliceUnique : slice type | semmle.label | call to SliceUnique : slice type |
+| test.go:297:21:297:78 | implicit dereference : FileHeader | semmle.label | implicit dereference : FileHeader |
+| test.go:297:21:297:87 | selection of Filename | semmle.label | selection of Filename |
+| test.go:303:15:303:36 | call to GetString : string | semmle.label | call to GetString : string |
+| test.go:305:21:305:48 | type assertion | semmle.label | type assertion |
+| test.go:306:21:306:32 | call to Items : map type | semmle.label | call to Items : map type |
+| test.go:306:21:306:52 | type assertion | semmle.label | type assertion |
subpaths
#select
-| test.go:28:13:28:30 | type conversion | test.go:26:6:26:10 | definition of bound : bindMe | test.go:28:13:28:30 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:26:6:26:10 | definition of bound | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:29:13:29:27 | type conversion | test.go:26:6:26:10 | definition of bound : bindMe | test.go:29:13:29:27 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:26:6:26:10 | definition of bound | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:30:13:30:29 | type conversion | test.go:26:6:26:10 | definition of bound : bindMe | test.go:30:13:30:29 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:26:6:26:10 | definition of bound | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:35:13:35:43 | type conversion | test.go:35:20:35:42 | call to Cookie : string | test.go:35:13:35:43 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:35:20:35:42 | call to Cookie | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:40:13:40:52 | type conversion | test.go:40:20:40:31 | call to Data : map type | test.go:40:13:40:52 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:40:20:40:31 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:45:13:45:53 | type conversion | test.go:45:20:45:43 | call to GetData : basic interface type | test.go:45:13:45:53 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:45:20:45:43 | call to GetData | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:50:13:50:43 | type conversion | test.go:50:20:50:42 | call to Header : string | test.go:50:13:50:43 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:50:20:50:42 | call to Header | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:55:13:55:42 | type conversion | test.go:55:20:55:41 | call to Param : string | test.go:55:13:55:42 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:55:20:55:41 | call to Param | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:60:13:60:45 | type conversion | test.go:60:20:60:33 | call to Params : map type | test.go:60:13:60:45 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:60:20:60:33 | call to Params | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:65:13:65:42 | type conversion | test.go:65:20:65:41 | call to Query : string | test.go:65:13:65:42 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:65:20:65:41 | call to Query | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:70:13:70:33 | type conversion | test.go:70:20:70:32 | call to Refer : string | test.go:70:13:70:33 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:70:20:70:32 | call to Refer | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:75:13:75:35 | type conversion | test.go:75:20:75:34 | call to Referer : string | test.go:75:13:75:35 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:75:20:75:34 | call to Referer | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:80:13:80:31 | type conversion | test.go:80:20:80:30 | call to URI : string | test.go:80:13:80:31 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:80:20:80:30 | call to URI | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:85:13:85:31 | type conversion | test.go:85:20:85:30 | call to URL : string | test.go:85:13:85:31 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:85:20:85:30 | call to URL | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:90:13:90:37 | type conversion | test.go:90:20:90:36 | call to UserAgent : string | test.go:90:13:90:37 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:90:20:90:36 | call to UserAgent | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:95:14:95:45 | type assertion | test.go:95:14:95:25 | call to Data : map type | test.go:95:14:95:45 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:95:14:95:25 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:107:14:107:45 | type assertion | test.go:107:14:107:25 | call to Data : map type | test.go:107:14:107:45 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:107:14:107:25 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:119:14:119:45 | type assertion | test.go:119:14:119:25 | call to Data : map type | test.go:119:14:119:45 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:119:14:119:25 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:136:23:136:62 | type assertion | test.go:136:23:136:42 | call to Data : map type | test.go:136:23:136:62 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:136:23:136:42 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:193:14:193:55 | type conversion | test.go:192:15:192:26 | call to Data : map type | test.go:193:14:193:55 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:192:15:192:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:194:14:194:58 | type conversion | test.go:192:15:192:26 | call to Data : map type | test.go:194:14:194:58 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:192:15:192:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:196:14:196:28 | type assertion | test.go:192:15:192:26 | call to Data : map type | test.go:196:14:196:28 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:192:15:192:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:197:14:197:55 | type conversion | test.go:192:15:192:26 | call to Data : map type | test.go:197:14:197:55 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:192:15:192:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:198:14:198:59 | type conversion | test.go:192:15:192:26 | call to Data : map type | test.go:198:14:198:59 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:192:15:192:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:202:14:202:28 | type conversion | test.go:201:18:201:33 | selection of Form : Values | test.go:202:14:202:28 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:201:18:201:33 | selection of Form | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:217:14:217:32 | type conversion | test.go:216:2:216:34 | ... := ...[1] : pointer type | test.go:217:14:217:32 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:216:2:216:34 | ... := ...[1] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:219:14:219:20 | content | test.go:216:2:216:34 | ... := ...[0] : File | test.go:219:14:219:20 | content | Cross-site scripting vulnerability due to $@. | test.go:216:2:216:34 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:222:14:222:38 | type conversion | test.go:221:2:221:40 | ... := ...[0] : slice type | test.go:222:14:222:38 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:221:2:221:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:225:14:225:22 | type conversion | test.go:224:7:224:28 | call to GetString : string | test.go:225:14:225:22 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:224:7:224:28 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:228:14:228:26 | type conversion | test.go:227:8:227:35 | call to GetStrings : slice type | test.go:228:14:228:26 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:227:8:227:35 | call to GetStrings | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:231:14:231:27 | type conversion | test.go:230:9:230:17 | call to Input : Values | test.go:231:14:231:27 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:230:9:230:17 | call to Input | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:235:14:235:30 | type conversion | test.go:233:6:233:8 | definition of str : myStruct | test.go:235:14:235:30 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:233:6:233:8 | definition of str | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:242:21:242:29 | untrusted | test.go:239:15:239:36 | call to GetString : string | test.go:242:21:242:29 | untrusted | Cross-site scripting vulnerability due to $@. | test.go:239:15:239:36 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:252:16:252:45 | type conversion | test.go:252:23:252:44 | call to GetCookie : string | test.go:252:16:252:45 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:252:23:252:44 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:257:16:257:37 | call to GetCookie | test.go:257:16:257:37 | call to GetCookie | test.go:257:16:257:37 | call to GetCookie | Cross-site scripting vulnerability due to $@. | test.go:257:16:257:37 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:258:15:258:41 | call to GetCookie | test.go:258:15:258:41 | call to GetCookie | test.go:258:15:258:41 | call to GetCookie | Cross-site scripting vulnerability due to $@. | test.go:258:15:258:41 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:263:55:263:84 | type conversion | test.go:263:62:263:83 | call to GetCookie : string | test.go:263:55:263:84 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:263:62:263:83 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:276:21:276:61 | call to GetDisplayString | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:276:21:276:61 | call to GetDisplayString | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:277:21:277:92 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:277:21:277:92 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:278:21:278:96 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:278:21:278:96 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:283:3:285:80 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:283:3:285:80 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:286:21:286:101 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:286:21:286:101 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:287:21:287:101 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:287:21:287:101 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:288:21:288:97 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:288:21:288:97 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:289:21:289:97 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:289:21:289:97 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:290:21:290:102 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:290:21:290:102 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:291:21:291:102 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:291:21:291:102 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:292:21:292:82 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:292:21:292:82 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:294:21:294:133 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:294:21:294:133 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:295:21:295:88 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:295:21:295:88 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:296:21:296:87 | selection of Filename | test.go:268:2:268:40 | ... := ...[0] : slice type | test.go:296:21:296:87 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:268:2:268:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:304:21:304:48 | type assertion | test.go:302:15:302:36 | call to GetString : string | test.go:304:21:304:48 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:302:15:302:36 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
-| test.go:305:21:305:52 | type assertion | test.go:302:15:302:36 | call to GetString : string | test.go:305:21:305:52 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:302:15:302:36 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:29:13:29:30 | type conversion | test.go:27:6:27:10 | definition of bound : bindMe | test.go:29:13:29:30 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:27:6:27:10 | definition of bound | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:30:13:30:27 | type conversion | test.go:27:6:27:10 | definition of bound : bindMe | test.go:30:13:30:27 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:27:6:27:10 | definition of bound | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:31:13:31:29 | type conversion | test.go:27:6:27:10 | definition of bound : bindMe | test.go:31:13:31:29 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:27:6:27:10 | definition of bound | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:36:13:36:43 | type conversion | test.go:36:20:36:42 | call to Cookie : string | test.go:36:13:36:43 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:36:20:36:42 | call to Cookie | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:41:13:41:52 | type conversion | test.go:41:20:41:31 | call to Data : map type | test.go:41:13:41:52 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:41:20:41:31 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:46:13:46:53 | type conversion | test.go:46:20:46:43 | call to GetData : basic interface type | test.go:46:13:46:53 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:46:20:46:43 | call to GetData | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:51:13:51:43 | type conversion | test.go:51:20:51:42 | call to Header : string | test.go:51:13:51:43 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:51:20:51:42 | call to Header | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:56:13:56:42 | type conversion | test.go:56:20:56:41 | call to Param : string | test.go:56:13:56:42 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:56:20:56:41 | call to Param | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:61:13:61:45 | type conversion | test.go:61:20:61:33 | call to Params : map type | test.go:61:13:61:45 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:61:20:61:33 | call to Params | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:66:13:66:42 | type conversion | test.go:66:20:66:41 | call to Query : string | test.go:66:13:66:42 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:66:20:66:41 | call to Query | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:71:13:71:33 | type conversion | test.go:71:20:71:32 | call to Refer : string | test.go:71:13:71:33 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:71:20:71:32 | call to Refer | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:76:13:76:35 | type conversion | test.go:76:20:76:34 | call to Referer : string | test.go:76:13:76:35 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:76:20:76:34 | call to Referer | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:81:13:81:31 | type conversion | test.go:81:20:81:30 | call to URI : string | test.go:81:13:81:31 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:81:20:81:30 | call to URI | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:86:13:86:31 | type conversion | test.go:86:20:86:30 | call to URL : string | test.go:86:13:86:31 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:86:20:86:30 | call to URL | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:91:13:91:37 | type conversion | test.go:91:20:91:36 | call to UserAgent : string | test.go:91:13:91:37 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:91:20:91:36 | call to UserAgent | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:96:14:96:45 | type assertion | test.go:96:14:96:25 | call to Data : map type | test.go:96:14:96:45 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:96:14:96:25 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:108:14:108:45 | type assertion | test.go:108:14:108:25 | call to Data : map type | test.go:108:14:108:45 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:108:14:108:25 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:120:14:120:45 | type assertion | test.go:120:14:120:25 | call to Data : map type | test.go:120:14:120:45 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:120:14:120:25 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:137:23:137:62 | type assertion | test.go:137:23:137:42 | call to Data : map type | test.go:137:23:137:62 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:137:23:137:42 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:194:14:194:55 | type conversion | test.go:193:15:193:26 | call to Data : map type | test.go:194:14:194:55 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:193:15:193:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:195:14:195:58 | type conversion | test.go:193:15:193:26 | call to Data : map type | test.go:195:14:195:58 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:193:15:193:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:197:14:197:28 | type assertion | test.go:193:15:193:26 | call to Data : map type | test.go:197:14:197:28 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:193:15:193:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:198:14:198:55 | type conversion | test.go:193:15:193:26 | call to Data : map type | test.go:198:14:198:55 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:193:15:193:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:199:14:199:59 | type conversion | test.go:193:15:193:26 | call to Data : map type | test.go:199:14:199:59 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:193:15:193:26 | call to Data | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:203:14:203:28 | type conversion | test.go:202:18:202:33 | selection of Form : Values | test.go:203:14:203:28 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:202:18:202:33 | selection of Form | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:218:14:218:32 | type conversion | test.go:217:2:217:34 | ... := ...[1] : pointer type | test.go:218:14:218:32 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:217:2:217:34 | ... := ...[1] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:220:14:220:20 | content | test.go:217:2:217:34 | ... := ...[0] : File | test.go:220:14:220:20 | content | Cross-site scripting vulnerability due to $@. | test.go:217:2:217:34 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:223:14:223:38 | type conversion | test.go:222:2:222:40 | ... := ...[0] : slice type | test.go:223:14:223:38 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:222:2:222:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:226:14:226:22 | type conversion | test.go:225:7:225:28 | call to GetString : string | test.go:226:14:226:22 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:225:7:225:28 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:229:14:229:26 | type conversion | test.go:228:8:228:35 | call to GetStrings : slice type | test.go:229:14:229:26 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:228:8:228:35 | call to GetStrings | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:232:14:232:27 | type conversion | test.go:231:9:231:17 | call to Input : Values | test.go:232:14:232:27 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:231:9:231:17 | call to Input | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:236:14:236:30 | type conversion | test.go:234:6:234:8 | definition of str : myStruct | test.go:236:14:236:30 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:234:6:234:8 | definition of str | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:243:21:243:29 | untrusted | test.go:240:15:240:36 | call to GetString : string | test.go:243:21:243:29 | untrusted | Cross-site scripting vulnerability due to $@. | test.go:240:15:240:36 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:253:16:253:45 | type conversion | test.go:253:23:253:44 | call to GetCookie : string | test.go:253:16:253:45 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:253:23:253:44 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:258:16:258:37 | call to GetCookie | test.go:258:16:258:37 | call to GetCookie | test.go:258:16:258:37 | call to GetCookie | Cross-site scripting vulnerability due to $@. | test.go:258:16:258:37 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:259:15:259:41 | call to GetCookie | test.go:259:15:259:41 | call to GetCookie | test.go:259:15:259:41 | call to GetCookie | Cross-site scripting vulnerability due to $@. | test.go:259:15:259:41 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:264:55:264:84 | type conversion | test.go:264:62:264:83 | call to GetCookie : string | test.go:264:55:264:84 | type conversion | Cross-site scripting vulnerability due to $@. | test.go:264:62:264:83 | call to GetCookie | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:277:21:277:61 | call to GetDisplayString | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:277:21:277:61 | call to GetDisplayString | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:278:21:278:92 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:278:21:278:92 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:279:21:279:96 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:279:21:279:96 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:284:3:286:80 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:284:3:286:80 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:287:21:287:101 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:287:21:287:101 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:288:21:288:101 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:288:21:288:101 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:289:21:289:97 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:289:21:289:97 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:290:21:290:97 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:290:21:290:97 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:291:21:291:102 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:291:21:291:102 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:292:21:292:102 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:292:21:292:102 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:293:21:293:82 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:293:21:293:82 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:295:21:295:133 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:295:21:295:133 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:296:21:296:88 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:296:21:296:88 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:297:21:297:87 | selection of Filename | test.go:269:2:269:40 | ... := ...[0] : slice type | test.go:297:21:297:87 | selection of Filename | Cross-site scripting vulnerability due to $@. | test.go:269:2:269:40 | ... := ...[0] | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:305:21:305:48 | type assertion | test.go:303:15:303:36 | call to GetString : string | test.go:305:21:305:48 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:303:15:303:36 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
+| test.go:306:21:306:52 | type assertion | test.go:303:15:303:36 | call to GetString : string | test.go:306:21:306:52 | type assertion | Cross-site scripting vulnerability due to $@. | test.go:303:15:303:36 | call to GetString | user-provided value | test.go:0:0:0:0 | test.go | |
diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Beego/TaintedPath.expected b/go/ql/test/library-tests/semmle/go/frameworks/Beego/TaintedPath.expected
index 76fec9f68d4..116d5d44a6d 100644
--- a/go/ql/test/library-tests/semmle/go/frameworks/Beego/TaintedPath.expected
+++ b/go/ql/test/library-tests/semmle/go/frameworks/Beego/TaintedPath.expected
@@ -1,14 +1,18 @@
edges
-| test.go:208:15:208:26 | call to Data : map type | test.go:209:18:209:26 | untrusted |
-| test.go:208:15:208:26 | call to Data : map type | test.go:210:10:210:18 | untrusted |
-| test.go:208:15:208:26 | call to Data : map type | test.go:211:35:211:43 | untrusted |
+| test.go:209:15:209:26 | call to Data : map type | test.go:210:18:210:26 | untrusted |
+| test.go:209:15:209:26 | call to Data : map type | test.go:211:10:211:18 | untrusted |
+| test.go:209:15:209:26 | call to Data : map type | test.go:212:35:212:43 | untrusted |
+| test.go:318:17:318:37 | selection of RequestBody : slice type | test.go:320:35:320:43 | untrusted |
nodes
-| test.go:208:15:208:26 | call to Data : map type | semmle.label | call to Data : map type |
-| test.go:209:18:209:26 | untrusted | semmle.label | untrusted |
-| test.go:210:10:210:18 | untrusted | semmle.label | untrusted |
-| test.go:211:35:211:43 | untrusted | semmle.label | untrusted |
+| test.go:209:15:209:26 | call to Data : map type | semmle.label | call to Data : map type |
+| test.go:210:18:210:26 | untrusted | semmle.label | untrusted |
+| test.go:211:10:211:18 | untrusted | semmle.label | untrusted |
+| test.go:212:35:212:43 | untrusted | semmle.label | untrusted |
+| test.go:318:17:318:37 | selection of RequestBody : slice type | semmle.label | selection of RequestBody : slice type |
+| test.go:320:35:320:43 | untrusted | semmle.label | untrusted |
subpaths
#select
-| test.go:209:18:209:26 | untrusted | test.go:208:15:208:26 | call to Data : map type | test.go:209:18:209:26 | untrusted | This path depends on a $@. | test.go:208:15:208:26 | call to Data | user-provided value |
-| test.go:210:10:210:18 | untrusted | test.go:208:15:208:26 | call to Data : map type | test.go:210:10:210:18 | untrusted | This path depends on a $@. | test.go:208:15:208:26 | call to Data | user-provided value |
-| test.go:211:35:211:43 | untrusted | test.go:208:15:208:26 | call to Data : map type | test.go:211:35:211:43 | untrusted | This path depends on a $@. | test.go:208:15:208:26 | call to Data | user-provided value |
+| test.go:210:18:210:26 | untrusted | test.go:209:15:209:26 | call to Data : map type | test.go:210:18:210:26 | untrusted | This path depends on a $@. | test.go:209:15:209:26 | call to Data | user-provided value |
+| test.go:211:10:211:18 | untrusted | test.go:209:15:209:26 | call to Data : map type | test.go:211:10:211:18 | untrusted | This path depends on a $@. | test.go:209:15:209:26 | call to Data | user-provided value |
+| test.go:212:35:212:43 | untrusted | test.go:209:15:209:26 | call to Data : map type | test.go:212:35:212:43 | untrusted | This path depends on a $@. | test.go:209:15:209:26 | call to Data | user-provided value |
+| test.go:320:35:320:43 | untrusted | test.go:318:17:318:37 | selection of RequestBody : slice type | test.go:320:35:320:43 | untrusted | This path depends on a $@. | test.go:318:17:318:37 | selection of RequestBody | user-provided value |
diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Beego/test.go b/go/ql/test/library-tests/semmle/go/frameworks/Beego/test.go
index b5953d8e768..4a0d91f6146 100644
--- a/go/ql/test/library-tests/semmle/go/frameworks/Beego/test.go
+++ b/go/ql/test/library-tests/semmle/go/frameworks/Beego/test.go
@@ -1,6 +1,7 @@
package test
import (
+ "encoding/json"
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
"github.com/astaxie/beego/logs"
@@ -310,3 +311,11 @@ func testSafeRedirects(c *beego.Controller, ctx *context.Context) {
c.Redirect(ctx.Input.URI(), 304)
ctx.Redirect(304, ctx.Input.URL())
}
+
+// BAD: using RequestBody data as path in a file-system operation
+func requestBodySourceTest(ctx *context.Context, c *beego.Controller) {
+ var dat map[string]interface{}
+ json.Unmarshal(ctx.Input.RequestBody, &dat)
+ untrusted := dat["filepath"].(string)
+ c.SaveToFile("someReceviedFile", untrusted)
+}
diff --git a/go/ql/test/query-tests/InconsistentCode/WrappedErrorAlwaysNil/WrappedErrorAlwaysNil.expected b/go/ql/test/query-tests/InconsistentCode/WrappedErrorAlwaysNil/WrappedErrorAlwaysNil.expected
index 4ac2411d7ca..43853d29664 100644
--- a/go/ql/test/query-tests/InconsistentCode/WrappedErrorAlwaysNil/WrappedErrorAlwaysNil.expected
+++ b/go/ql/test/query-tests/InconsistentCode/WrappedErrorAlwaysNil/WrappedErrorAlwaysNil.expected
@@ -1,4 +1,4 @@
-| WrappedErrorAlwaysNil.go:31:22:31:24 | err | The first argument to 'errors.Wrap' is always nil |
-| WrappedErrorAlwaysNil.go:41:14:41:16 | nil | The first argument to 'errors.Wrap' is always nil |
-| WrappedErrorAlwaysNil.go:45:14:45:16 | err | The first argument to 'errors.Wrap' is always nil |
-| WrappedErrorAlwaysNil.go:49:14:49:21 | localErr | The first argument to 'errors.Wrap' is always nil |
+| WrappedErrorAlwaysNil.go:31:22:31:24 | err | The first argument to 'errors.Wrap' is always nil. |
+| WrappedErrorAlwaysNil.go:41:14:41:16 | nil | The first argument to 'errors.Wrap' is always nil. |
+| WrappedErrorAlwaysNil.go:45:14:45:16 | err | The first argument to 'errors.Wrap' is always nil. |
+| WrappedErrorAlwaysNil.go:49:14:49:21 | localErr | The first argument to 'errors.Wrap' is always nil. |
diff --git a/go/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/SuspiciousCharacterInRegexp.expected b/go/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/SuspiciousCharacterInRegexp.expected
index 130894d0639..cea5780a6c5 100644
--- a/go/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/SuspiciousCharacterInRegexp.expected
+++ b/go/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/SuspiciousCharacterInRegexp.expected
@@ -13,14 +13,14 @@ nodes
| test.go:23:21:23:36 | "hello\\\\\\bworld" | semmle.label | "hello\\\\\\bworld" |
subpaths
#select
-| SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | $@ that is $@ contains a literal backspace \\b; did you mean \\\\b, a word boundary? | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | A string literal | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | used as a regular expression |
-| test.go:7:21:7:24 | "\\a" | test.go:7:21:7:24 | "\\a" | test.go:7:21:7:24 | "\\a" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:7:21:7:24 | "\\a" | A string literal | test.go:7:21:7:24 | "\\a" | used as a regular expression |
-| test.go:9:21:9:26 | "\\\\\\a" | test.go:9:21:9:26 | "\\\\\\a" | test.go:9:21:9:26 | "\\\\\\a" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:9:21:9:26 | "\\\\\\a" | A string literal | test.go:9:21:9:26 | "\\\\\\a" | used as a regular expression |
-| test.go:10:21:10:27 | "x\\\\\\a" | test.go:10:21:10:27 | "x\\\\\\a" | test.go:10:21:10:27 | "x\\\\\\a" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:10:21:10:27 | "x\\\\\\a" | A string literal | test.go:10:21:10:27 | "x\\\\\\a" | used as a regular expression |
-| test.go:12:21:12:28 | "\\\\\\\\\\a" | test.go:12:21:12:28 | "\\\\\\\\\\a" | test.go:12:21:12:28 | "\\\\\\\\\\a" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:12:21:12:28 | "\\\\\\\\\\a" | A string literal | test.go:12:21:12:28 | "\\\\\\\\\\a" | used as a regular expression |
-| test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | A string literal | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | used as a regular expression |
-| test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | A string literal | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | used as a regular expression |
-| test.go:20:21:20:34 | "hello\\aworld" | test.go:20:21:20:34 | "hello\\aworld" | test.go:20:21:20:34 | "hello\\aworld" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:20:21:20:34 | "hello\\aworld" | A string literal | test.go:20:21:20:34 | "hello\\aworld" | used as a regular expression |
-| test.go:21:21:21:36 | "hello\\\\\\aworld" | test.go:21:21:21:36 | "hello\\\\\\aworld" | test.go:21:21:21:36 | "hello\\\\\\aworld" | $@ that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:21:21:21:36 | "hello\\\\\\aworld" | A string literal | test.go:21:21:21:36 | "hello\\\\\\aworld" | used as a regular expression |
-| test.go:22:21:22:34 | "hello\\bworld" | test.go:22:21:22:34 | "hello\\bworld" | test.go:22:21:22:34 | "hello\\bworld" | $@ that is $@ contains a literal backspace \\b; did you mean \\\\b, a word boundary? | test.go:22:21:22:34 | "hello\\bworld" | A string literal | test.go:22:21:22:34 | "hello\\bworld" | used as a regular expression |
-| test.go:23:21:23:36 | "hello\\\\\\bworld" | test.go:23:21:23:36 | "hello\\\\\\bworld" | test.go:23:21:23:36 | "hello\\\\\\bworld" | $@ that is $@ contains a literal backspace \\b; did you mean \\\\b, a word boundary? | test.go:23:21:23:36 | "hello\\\\\\bworld" | A string literal | test.go:23:21:23:36 | "hello\\\\\\bworld" | used as a regular expression |
+| SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | This string literal that is $@ contains a literal backspace \\b; did you mean \\\\b, a word boundary? | SuspiciousCharacterInRegexp.go:6:34:6:55 | "\\bforbidden.host.org" | used as a regular expression |
+| test.go:7:21:7:24 | "\\a" | test.go:7:21:7:24 | "\\a" | test.go:7:21:7:24 | "\\a" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:7:21:7:24 | "\\a" | used as a regular expression |
+| test.go:9:21:9:26 | "\\\\\\a" | test.go:9:21:9:26 | "\\\\\\a" | test.go:9:21:9:26 | "\\\\\\a" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:9:21:9:26 | "\\\\\\a" | used as a regular expression |
+| test.go:10:21:10:27 | "x\\\\\\a" | test.go:10:21:10:27 | "x\\\\\\a" | test.go:10:21:10:27 | "x\\\\\\a" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:10:21:10:27 | "x\\\\\\a" | used as a regular expression |
+| test.go:12:21:12:28 | "\\\\\\\\\\a" | test.go:12:21:12:28 | "\\\\\\\\\\a" | test.go:12:21:12:28 | "\\\\\\\\\\a" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:12:21:12:28 | "\\\\\\\\\\a" | used as a regular expression |
+| test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:14:21:14:30 | "\\\\\\\\\\\\\\a" | used as a regular expression |
+| test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:16:21:16:32 | "\\\\\\\\\\\\\\\\\\a" | used as a regular expression |
+| test.go:20:21:20:34 | "hello\\aworld" | test.go:20:21:20:34 | "hello\\aworld" | test.go:20:21:20:34 | "hello\\aworld" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:20:21:20:34 | "hello\\aworld" | used as a regular expression |
+| test.go:21:21:21:36 | "hello\\\\\\aworld" | test.go:21:21:21:36 | "hello\\\\\\aworld" | test.go:21:21:21:36 | "hello\\\\\\aworld" | This string literal that is $@ contains the bell character \\a; did you mean \\\\a, the Vim alphabetic character class (use [[:alpha:]] instead) or \\\\A, the beginning of text? | test.go:21:21:21:36 | "hello\\\\\\aworld" | used as a regular expression |
+| test.go:22:21:22:34 | "hello\\bworld" | test.go:22:21:22:34 | "hello\\bworld" | test.go:22:21:22:34 | "hello\\bworld" | This string literal that is $@ contains a literal backspace \\b; did you mean \\\\b, a word boundary? | test.go:22:21:22:34 | "hello\\bworld" | used as a regular expression |
+| test.go:23:21:23:36 | "hello\\\\\\bworld" | test.go:23:21:23:36 | "hello\\\\\\bworld" | test.go:23:21:23:36 | "hello\\\\\\bworld" | This string literal that is $@ contains a literal backspace \\b; did you mean \\\\b, a word boundary? | test.go:23:21:23:36 | "hello\\\\\\bworld" | used as a regular expression |
diff --git a/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected b/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected
index be68561ca27..2ba310c6ee1 100644
--- a/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected
+++ b/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected
@@ -20,8 +20,8 @@ nodes
| sample.go:47:17:47:39 | call to Intn | semmle.label | call to Intn |
subpaths
#select
-| InsecureRandomness.go:12:18:12:40 | call to Intn | InsecureRandomness.go:12:18:12:40 | call to Intn | InsecureRandomness.go:12:18:12:40 | call to Intn | $@ generated with a cryptographically weak RNG is used in $@. | InsecureRandomness.go:12:18:12:40 | call to Intn | A random number | InsecureRandomness.go:12:18:12:40 | call to Intn | a password-related function |
-| sample.go:26:25:26:30 | call to Guid | sample.go:15:49:15:61 | call to Uint32 : uint32 | sample.go:26:25:26:30 | call to Guid | $@ generated with a cryptographically weak RNG is used in $@. | sample.go:15:49:15:61 | call to Uint32 | A random number | sample.go:26:25:26:30 | call to Guid | this cryptographic algorithm |
-| sample.go:37:25:37:29 | nonce | sample.go:34:12:34:40 | call to New : pointer type | sample.go:37:25:37:29 | nonce | $@ generated with a cryptographically weak RNG is used in $@. | sample.go:34:12:34:40 | call to New | A random number | sample.go:37:25:37:29 | nonce | this cryptographic algorithm |
-| sample.go:37:32:37:36 | nonce | sample.go:34:12:34:40 | call to New : pointer type | sample.go:37:32:37:36 | nonce | $@ generated with a cryptographically weak RNG is used in $@. | sample.go:34:12:34:40 | call to New | A random number | sample.go:37:32:37:36 | nonce | this cryptographic algorithm |
-| sample.go:43:17:43:39 | call to Intn | sample.go:43:17:43:39 | call to Intn | sample.go:43:17:43:39 | call to Intn | $@ generated with a cryptographically weak RNG is used in $@. | sample.go:43:17:43:39 | call to Intn | A random number | sample.go:43:17:43:39 | call to Intn | a password-related function |
+| InsecureRandomness.go:12:18:12:40 | call to Intn | InsecureRandomness.go:12:18:12:40 | call to Intn | InsecureRandomness.go:12:18:12:40 | call to Intn | A password-related function depends on a $@ generated with a cryptographically weak RNG. | InsecureRandomness.go:12:18:12:40 | call to Intn | random number |
+| sample.go:26:25:26:30 | call to Guid | sample.go:15:49:15:61 | call to Uint32 : uint32 | sample.go:26:25:26:30 | call to Guid | This cryptographic algorithm depends on a $@ generated with a cryptographically weak RNG. | sample.go:15:49:15:61 | call to Uint32 | random number |
+| sample.go:37:25:37:29 | nonce | sample.go:34:12:34:40 | call to New : pointer type | sample.go:37:25:37:29 | nonce | This cryptographic algorithm depends on a $@ generated with a cryptographically weak RNG. | sample.go:34:12:34:40 | call to New | random number |
+| sample.go:37:32:37:36 | nonce | sample.go:34:12:34:40 | call to New : pointer type | sample.go:37:32:37:36 | nonce | This cryptographic algorithm depends on a $@ generated with a cryptographically weak RNG. | sample.go:34:12:34:40 | call to New | random number |
+| sample.go:43:17:43:39 | call to Intn | sample.go:43:17:43:39 | call to Intn | sample.go:43:17:43:39 | call to Intn | A password-related function depends on a $@ generated with a cryptographically weak RNG. | sample.go:43:17:43:39 | call to Intn | random number |
diff --git a/go/ql/test/query-tests/Security/CWE-918/websocket.go b/go/ql/test/query-tests/Security/CWE-918/websocket.go
index db613fe5fa5..328200770ae 100644
--- a/go/ql/test/query-tests/Security/CWE-918/websocket.go
+++ b/go/ql/test/query-tests/Security/CWE-918/websocket.go
@@ -96,7 +96,7 @@ func test() {
http.HandleFunc("/ex5", func(w http.ResponseWriter, r *http.Request) {
untrustedInput := r.Referer()
- // good as input is tested againt regex
+ // good as input is tested against regex
if m, _ := regexp.MatchString("ws://localhost:12345/*", untrustedInput); m {
nhooyr.Dial(context.TODO(), untrustedInput, nil)
}
diff --git a/java/documentation/library-coverage/coverage.csv b/java/documentation/library-coverage/coverage.csv
index 425da54f994..189dbab6b94 100644
--- a/java/documentation/library-coverage/coverage.csv
+++ b/java/documentation/library-coverage/coverage.csv
@@ -36,10 +36,10 @@ jakarta.ws.rs.client,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,
jakarta.ws.rs.container,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,
jakarta.ws.rs.core,2,,149,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,94,55
java.beans,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,
-java.io,37,,39,,15,,,,,,,,,,,,,,,,,,,,,,,,,22,,,,,,,,39,
+java.io,37,,40,,15,,,,,,,,,,,,,,,,,,,,,,,,,22,,,,,,,,40,
java.lang,13,,66,,,,,,,,,,,8,,,,,4,,,1,,,,,,,,,,,,,,,,54,12
java.net,10,3,7,,,,,,,,,,,,,,10,,,,,,,,,,,,,,,,,,,,3,7,
-java.nio,15,,11,,13,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,11,
+java.nio,15,,14,,13,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,14,
java.sql,11,,,,,,,,,4,,,,,,,,,,,,,,,,7,,,,,,,,,,,,,
java.util,44,,461,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,36,425
javax.faces.context,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,7,,
diff --git a/java/documentation/library-coverage/coverage.rst b/java/documentation/library-coverage/coverage.rst
index 4c4e0c96d86..1c6e7136efc 100644
--- a/java/documentation/library-coverage/coverage.rst
+++ b/java/documentation/library-coverage/coverage.rst
@@ -15,9 +15,9 @@ Java framework & library support
`Apache HttpComponents `_,"``org.apache.hc.core5.*``, ``org.apache.http``",5,136,28,,,3,,,,25
`Google Guava `_,``com.google.common.*``,,728,39,,6,,,,,
`JSON-java `_,``org.json``,,236,,,,,,,,
- Java Standard Library,``java.*``,3,585,130,28,,,7,,,10
+ Java Standard Library,``java.*``,3,589,130,28,,,7,,,10
Java extensions,"``javax.*``, ``jakarta.*``",63,609,32,,,4,,1,1,2
`Spring `_,``org.springframework.*``,29,477,101,,,,19,14,,29
Others,"``androidx.core.app``, ``androidx.slice``, ``cn.hutool.core.codec``, ``com.esotericsoftware.kryo.io``, ``com.esotericsoftware.kryo5.io``, ``com.fasterxml.jackson.core``, ``com.fasterxml.jackson.databind``, ``com.hubspot.jinjava``, ``com.mitchellbosecke.pebble``, ``com.opensymphony.xwork2.ognl``, ``com.rabbitmq.client``, ``com.unboundid.ldap.sdk``, ``com.zaxxer.hikari``, ``flexjson``, ``freemarker.cache``, ``freemarker.template``, ``groovy.lang``, ``groovy.util``, ``jodd.json``, ``kotlin``, ``net.sf.saxon.s9api``, ``ognl``, ``okhttp3``, ``org.apache.commons.codec``, ``org.apache.commons.jexl2``, ``org.apache.commons.jexl3``, ``org.apache.commons.logging``, ``org.apache.commons.ognl``, ``org.apache.directory.ldap.client.api``, ``org.apache.ibatis.jdbc``, ``org.apache.log4j``, ``org.apache.logging.log4j``, ``org.apache.shiro.codec``, ``org.apache.shiro.jndi``, ``org.apache.velocity.app``, ``org.apache.velocity.runtime``, ``org.codehaus.groovy.control``, ``org.dom4j``, ``org.hibernate``, ``org.jboss.logging``, ``org.jdbi.v3.core``, ``org.jooq``, ``org.mvel2``, ``org.scijava.log``, ``org.slf4j``, ``org.thymeleaf``, ``org.xml.sax``, ``org.xmlpull.v1``, ``play.mvc``, ``ratpack.core.form``, ``ratpack.core.handling``, ``ratpack.core.http``, ``ratpack.exec``, ``ratpack.form``, ``ratpack.func``, ``ratpack.handling``, ``ratpack.http``, ``ratpack.util``, ``retrofit2``",65,2326,972,10,,,14,18,,5
- Totals,,217,8428,1524,129,6,10,107,33,1,86
+ Totals,,217,8432,1524,129,6,10,107,33,1,86
diff --git a/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/hasModifier.ql b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/hasModifier.ql
new file mode 100644
index 00000000000..0d1c2f3514b
--- /dev/null
+++ b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/hasModifier.ql
@@ -0,0 +1,19 @@
+class Modifier extends @modifier {
+ string toString() { none() }
+}
+
+class TypeVariable extends @typevariable {
+ string toString() { none() }
+}
+
+class Modified extends @modifiable {
+ Modified() { hasModifier(this, _) }
+
+ string toString() { none() }
+}
+
+from Modified m1, Modifier m2
+where
+ hasModifier(m1, m2) and
+ not m1 instanceof TypeVariable
+select m1, m2
diff --git a/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/modifiers.ql b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/modifiers.ql
new file mode 100644
index 00000000000..baa997f7fd8
--- /dev/null
+++ b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/modifiers.ql
@@ -0,0 +1,11 @@
+class Modifier extends @modifier {
+ string toString() { none() }
+
+ string getName() { modifiers(this, result) }
+}
+
+from Modifier m, string s
+where
+ s = m.getName() and
+ not s in ["in", "out", "reified"]
+select m, m.getName()
diff --git a/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/old.dbscheme b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/old.dbscheme
new file mode 100644
index 00000000000..709f1d1fd04
--- /dev/null
+++ b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/old.dbscheme
@@ -0,0 +1,1240 @@
+/**
+ * An invocation of the compiler. Note that more than one file may be
+ * compiled per invocation. For example, this command compiles three
+ * source files:
+ *
+ * javac A.java B.java C.java
+ *
+ * The `id` simply identifies the invocation, while `cwd` is the working
+ * directory from which the compiler was invoked.
+ */
+compilations(
+ /**
+ * An invocation of the compiler. Note that more than one file may
+ * be compiled per invocation. For example, this command compiles
+ * three source files:
+ *
+ * javac A.java B.java C.java
+ */
+ unique int id : @compilation,
+ int kind: int ref,
+ string cwd : string ref,
+ string name : string ref
+);
+
+case @compilation.kind of
+ 1 = @javacompilation
+| 2 = @kotlincompilation
+;
+
+compilation_started(
+ int id : @compilation ref
+)
+
+/**
+ * The arguments that were passed to the extractor for a compiler
+ * invocation. If `id` is for the compiler invocation
+ *
+ * javac A.java B.java C.java
+ *
+ * then typically there will be rows for
+ *
+ * num | arg
+ * --- | ---
+ * 0 | *path to extractor*
+ * 1 | `--javac-args`
+ * 2 | A.java
+ * 3 | B.java
+ * 4 | C.java
+ */
+#keyset[id, num]
+compilation_args(
+ int id : @compilation ref,
+ int num : int ref,
+ string arg : string ref
+);
+
+/**
+ * The source files that are compiled by a compiler invocation.
+ * If `id` is for the compiler invocation
+ *
+ * javac A.java B.java C.java
+ *
+ * then there will be rows for
+ *
+ * num | arg
+ * --- | ---
+ * 0 | A.java
+ * 1 | B.java
+ * 2 | C.java
+ */
+#keyset[id, num]
+compilation_compiling_files(
+ int id : @compilation ref,
+ int num : int ref,
+ int file : @file ref
+);
+
+/**
+ * For each file recorded in `compilation_compiling_files`,
+ * there will be a corresponding row in
+ * `compilation_compiling_files_completed` once extraction
+ * of that file is complete. The `result` will indicate the
+ * extraction result:
+ *
+ * 0: Successfully extracted
+ * 1: Errors were encountered, but extraction recovered
+ * 2: Errors were encountered, and extraction could not recover
+ */
+#keyset[id, num]
+compilation_compiling_files_completed(
+ int id : @compilation ref,
+ int num : int ref,
+ int result : int ref
+);
+
+/**
+ * The time taken by the extractor for a compiler invocation.
+ *
+ * For each file `num`, there will be rows for
+ *
+ * kind | seconds
+ * ---- | ---
+ * 1 | CPU seconds used by the extractor frontend
+ * 2 | Elapsed seconds during the extractor frontend
+ * 3 | CPU seconds used by the extractor backend
+ * 4 | Elapsed seconds during the extractor backend
+ */
+#keyset[id, num, kind]
+compilation_time(
+ int id : @compilation ref,
+ int num : int ref,
+ /* kind:
+ 1 = frontend_cpu_seconds
+ 2 = frontend_elapsed_seconds
+ 3 = extractor_cpu_seconds
+ 4 = extractor_elapsed_seconds
+ */
+ int kind : int ref,
+ float seconds : float ref
+);
+
+/**
+ * An error or warning generated by the extractor.
+ * The diagnostic message `diagnostic` was generated during compiler
+ * invocation `compilation`, and is the `file_number_diagnostic_number`th
+ * message generated while extracting the `file_number`th file of that
+ * invocation.
+ */
+#keyset[compilation, file_number, file_number_diagnostic_number]
+diagnostic_for(
+ unique int diagnostic : @diagnostic ref,
+ int compilation : @compilation ref,
+ int file_number : int ref,
+ int file_number_diagnostic_number : int ref
+);
+
+/**
+ * The `cpu_seconds` and `elapsed_seconds` are the CPU time and elapsed
+ * time (respectively) that the original compilation (not the extraction)
+ * took for compiler invocation `id`.
+ */
+compilation_compiler_times(
+ unique int id : @compilation ref,
+ float cpu_seconds : float ref,
+ float elapsed_seconds : float ref
+);
+
+/**
+ * If extraction was successful, then `cpu_seconds` and
+ * `elapsed_seconds` are the CPU time and elapsed time (respectively)
+ * that extraction took for compiler invocation `id`.
+ * The `result` will indicate the extraction result:
+ *
+ * 0: Successfully extracted
+ * 1: Errors were encountered, but extraction recovered
+ * 2: Errors were encountered, and extraction could not recover
+ */
+compilation_finished(
+ unique int id : @compilation ref,
+ float cpu_seconds : float ref,
+ float elapsed_seconds : float ref,
+ int result : int ref
+);
+
+diagnostics(
+ unique int id: @diagnostic,
+ string generated_by: string ref, // TODO: Sync this with the other languages?
+ int severity: int ref,
+ string error_tag: string ref,
+ string error_message: string ref,
+ string full_error_message: string ref,
+ int location: @location_default ref
+);
+
+/*
+ * External artifacts
+ */
+
+externalData(
+ int id : @externalDataElement,
+ string path : string ref,
+ int column: int ref,
+ string value : string ref
+);
+
+snapshotDate(
+ unique date snapshotDate : date ref
+);
+
+sourceLocationPrefix(
+ string prefix : string ref
+);
+
+/*
+ * Duplicate code
+ */
+
+duplicateCode(
+ unique int id : @duplication,
+ string relativePath : string ref,
+ int equivClass : int ref
+);
+
+similarCode(
+ unique int id : @similarity,
+ string relativePath : string ref,
+ int equivClass : int ref
+);
+
+@duplication_or_similarity = @duplication | @similarity
+
+tokens(
+ int id : @duplication_or_similarity ref,
+ int offset : int ref,
+ int beginLine : int ref,
+ int beginColumn : int ref,
+ int endLine : int ref,
+ int endColumn : int ref
+);
+
+/*
+ * SMAP
+ */
+
+smap_header(
+ int outputFileId: @file ref,
+ string outputFilename: string ref,
+ string defaultStratum: string ref
+);
+
+smap_files(
+ int outputFileId: @file ref,
+ string stratum: string ref,
+ int inputFileNum: int ref,
+ string inputFileName: string ref,
+ int inputFileId: @file ref
+);
+
+smap_lines(
+ int outputFileId: @file ref,
+ string stratum: string ref,
+ int inputFileNum: int ref,
+ int inputStartLine: int ref,
+ int inputLineCount: int ref,
+ int outputStartLine: int ref,
+ int outputLineIncrement: int ref
+);
+
+/*
+ * Locations and files
+ */
+
+@location = @location_default ;
+
+locations_default(
+ unique int id: @location_default,
+ int file: @file ref,
+ int beginLine: int ref,
+ int beginColumn: int ref,
+ int endLine: int ref,
+ int endColumn: int ref
+);
+
+hasLocation(
+ int locatableid: @locatable ref,
+ int id: @location ref
+);
+
+@sourceline = @locatable ;
+
+#keyset[element_id]
+numlines(
+ int element_id: @sourceline ref,
+ int num_lines: int ref,
+ int num_code: int ref,
+ int num_comment: int ref
+);
+
+files(
+ unique int id: @file,
+ string name: string ref
+);
+
+folders(
+ unique int id: @folder,
+ string name: string ref
+);
+
+@container = @folder | @file
+
+containerparent(
+ int parent: @container ref,
+ unique int child: @container ref
+);
+
+/*
+ * Java
+ */
+
+cupackage(
+ unique int id: @file ref,
+ int packageid: @package ref
+);
+
+#keyset[fileid,keyName]
+jarManifestMain(
+ int fileid: @file ref,
+ string keyName: string ref,
+ string value: string ref
+);
+
+#keyset[fileid,entryName,keyName]
+jarManifestEntries(
+ int fileid: @file ref,
+ string entryName: string ref,
+ string keyName: string ref,
+ string value: string ref
+);
+
+packages(
+ unique int id: @package,
+ string nodeName: string ref
+);
+
+primitives(
+ unique int id: @primitive,
+ string nodeName: string ref
+);
+
+modifiers(
+ unique int id: @modifier,
+ string nodeName: string ref
+);
+
+/**
+ * An errortype is used when the extractor is unable to extract a type
+ * correctly for some reason.
+ */
+error_type(
+ unique int id: @errortype
+);
+
+classes(
+ unique int id: @class,
+ string nodeName: string ref,
+ int parentid: @package ref,
+ int sourceid: @class ref
+);
+
+file_class(
+ int id: @class ref
+);
+
+class_object(
+ unique int id: @class ref,
+ unique int instance: @field ref
+);
+
+type_companion_object(
+ unique int id: @classorinterface ref,
+ unique int instance: @field ref,
+ unique int companion_object: @class ref
+);
+
+kt_nullable_types(
+ unique int id: @kt_nullable_type,
+ int classid: @reftype ref
+)
+
+kt_notnull_types(
+ unique int id: @kt_notnull_type,
+ int classid: @reftype ref
+)
+
+kt_type_alias(
+ unique int id: @kt_type_alias,
+ string name: string ref,
+ int kttypeid: @kt_type ref
+)
+
+@kt_type = @kt_nullable_type | @kt_notnull_type
+
+isRecord(
+ unique int id: @class ref
+);
+
+interfaces(
+ unique int id: @interface,
+ string nodeName: string ref,
+ int parentid: @package ref,
+ int sourceid: @interface ref
+);
+
+fielddecls(
+ unique int id: @fielddecl,
+ int parentid: @reftype ref
+);
+
+#keyset[fieldId] #keyset[fieldDeclId,pos]
+fieldDeclaredIn(
+ int fieldId: @field ref,
+ int fieldDeclId: @fielddecl ref,
+ int pos: int ref
+);
+
+fields(
+ unique int id: @field,
+ string nodeName: string ref,
+ int typeid: @type ref,
+ int parentid: @reftype ref,
+ int sourceid: @field ref
+);
+
+fieldsKotlinType(
+ unique int id: @field ref,
+ int kttypeid: @kt_type ref
+);
+
+constrs(
+ unique int id: @constructor,
+ string nodeName: string ref,
+ string signature: string ref,
+ int typeid: @type ref,
+ int parentid: @reftype ref,
+ int sourceid: @constructor ref
+);
+
+constrsKotlinType(
+ unique int id: @constructor ref,
+ int kttypeid: @kt_type ref
+);
+
+methods(
+ unique int id: @method,
+ string nodeName: string ref,
+ string signature: string ref,
+ int typeid: @type ref,
+ int parentid: @reftype ref,
+ int sourceid: @method ref
+);
+
+methodsKotlinType(
+ unique int id: @method ref,
+ int kttypeid: @kt_type ref
+);
+
+#keyset[parentid,pos]
+params(
+ unique int id: @param,
+ int typeid: @type ref,
+ int pos: int ref,
+ int parentid: @callable ref,
+ int sourceid: @param ref
+);
+
+paramsKotlinType(
+ unique int id: @param ref,
+ int kttypeid: @kt_type ref
+);
+
+paramName(
+ unique int id: @param ref,
+ string nodeName: string ref
+);
+
+isVarargsParam(
+ int param: @param ref
+);
+
+exceptions(
+ unique int id: @exception,
+ int typeid: @type ref,
+ int parentid: @callable ref
+);
+
+isAnnotType(
+ int interfaceid: @interface ref
+);
+
+isAnnotElem(
+ int methodid: @method ref
+);
+
+annotValue(
+ int parentid: @annotation ref,
+ int id2: @method ref,
+ unique int value: @expr ref
+);
+
+isEnumType(
+ int classid: @class ref
+);
+
+isEnumConst(
+ int fieldid: @field ref
+);
+
+#keyset[parentid,pos]
+typeVars(
+ unique int id: @typevariable,
+ string nodeName: string ref,
+ int pos: int ref,
+ int kind: int ref, // deprecated
+ int parentid: @classorinterfaceorcallable ref
+);
+
+wildcards(
+ unique int id: @wildcard,
+ string nodeName: string ref,
+ int kind: int ref
+);
+
+#keyset[parentid,pos]
+typeBounds(
+ unique int id: @typebound,
+ int typeid: @reftype ref,
+ int pos: int ref,
+ int parentid: @boundedtype ref
+);
+
+#keyset[parentid,pos]
+typeArgs(
+ int argumentid: @reftype ref,
+ int pos: int ref,
+ int parentid: @classorinterfaceorcallable ref
+);
+
+isParameterized(
+ int memberid: @member ref
+);
+
+isRaw(
+ int memberid: @member ref
+);
+
+erasure(
+ unique int memberid: @member ref,
+ int erasureid: @member ref
+);
+
+#keyset[classid] #keyset[parent]
+isAnonymClass(
+ int classid: @class ref,
+ int parent: @classinstancexpr ref
+);
+
+#keyset[typeid] #keyset[parent]
+isLocalClassOrInterface(
+ int typeid: @classorinterface ref,
+ int parent: @localtypedeclstmt ref
+);
+
+isDefConstr(
+ int constructorid: @constructor ref
+);
+
+#keyset[exprId]
+lambdaKind(
+ int exprId: @lambdaexpr ref,
+ int bodyKind: int ref
+);
+
+arrays(
+ unique int id: @array,
+ string nodeName: string ref,
+ int elementtypeid: @type ref,
+ int dimension: int ref,
+ int componenttypeid: @type ref
+);
+
+enclInReftype(
+ unique int child: @reftype ref,
+ int parent: @reftype ref
+);
+
+extendsReftype(
+ int id1: @reftype ref,
+ int id2: @classorinterface ref
+);
+
+implInterface(
+ int id1: @classorarray ref,
+ int id2: @interface ref
+);
+
+permits(
+ int id1: @classorinterface ref,
+ int id2: @classorinterface ref
+);
+
+hasModifier(
+ int id1: @modifiable ref,
+ int id2: @modifier ref
+);
+
+imports(
+ unique int id: @import,
+ int holder: @classorinterfaceorpackage ref,
+ string name: string ref,
+ int kind: int ref
+);
+
+#keyset[parent,idx]
+stmts(
+ unique int id: @stmt,
+ int kind: int ref,
+ int parent: @stmtparent ref,
+ int idx: int ref,
+ int bodydecl: @callable ref
+);
+
+@stmtparent = @callable | @stmt | @switchexpr | @whenexpr| @stmtexpr;
+
+case @stmt.kind of
+ 0 = @block
+| 1 = @ifstmt
+| 2 = @forstmt
+| 3 = @enhancedforstmt
+| 4 = @whilestmt
+| 5 = @dostmt
+| 6 = @trystmt
+| 7 = @switchstmt
+| 8 = @synchronizedstmt
+| 9 = @returnstmt
+| 10 = @throwstmt
+| 11 = @breakstmt
+| 12 = @continuestmt
+| 13 = @emptystmt
+| 14 = @exprstmt
+| 15 = @labeledstmt
+| 16 = @assertstmt
+| 17 = @localvariabledeclstmt
+| 18 = @localtypedeclstmt
+| 19 = @constructorinvocationstmt
+| 20 = @superconstructorinvocationstmt
+| 21 = @case
+| 22 = @catchclause
+| 23 = @yieldstmt
+| 24 = @errorstmt
+| 25 = @whenbranch
+;
+
+#keyset[parent,idx]
+exprs(
+ unique int id: @expr,
+ int kind: int ref,
+ int typeid: @type ref,
+ int parent: @exprparent ref,
+ int idx: int ref
+);
+
+exprsKotlinType(
+ unique int id: @expr ref,
+ int kttypeid: @kt_type ref
+);
+
+callableEnclosingExpr(
+ unique int id: @expr ref,
+ int callable_id: @callable ref
+);
+
+statementEnclosingExpr(
+ unique int id: @expr ref,
+ int statement_id: @stmt ref
+);
+
+isParenthesized(
+ unique int id: @expr ref,
+ int parentheses: int ref
+);
+
+case @expr.kind of
+ 1 = @arrayaccess
+| 2 = @arraycreationexpr
+| 3 = @arrayinit
+| 4 = @assignexpr
+| 5 = @assignaddexpr
+| 6 = @assignsubexpr
+| 7 = @assignmulexpr
+| 8 = @assigndivexpr
+| 9 = @assignremexpr
+| 10 = @assignandexpr
+| 11 = @assignorexpr
+| 12 = @assignxorexpr
+| 13 = @assignlshiftexpr
+| 14 = @assignrshiftexpr
+| 15 = @assignurshiftexpr
+| 16 = @booleanliteral
+| 17 = @integerliteral
+| 18 = @longliteral
+| 19 = @floatingpointliteral
+| 20 = @doubleliteral
+| 21 = @characterliteral
+| 22 = @stringliteral
+| 23 = @nullliteral
+| 24 = @mulexpr
+| 25 = @divexpr
+| 26 = @remexpr
+| 27 = @addexpr
+| 28 = @subexpr
+| 29 = @lshiftexpr
+| 30 = @rshiftexpr
+| 31 = @urshiftexpr
+| 32 = @andbitexpr
+| 33 = @orbitexpr
+| 34 = @xorbitexpr
+| 35 = @andlogicalexpr
+| 36 = @orlogicalexpr
+| 37 = @ltexpr
+| 38 = @gtexpr
+| 39 = @leexpr
+| 40 = @geexpr
+| 41 = @eqexpr
+| 42 = @neexpr
+| 43 = @postincexpr
+| 44 = @postdecexpr
+| 45 = @preincexpr
+| 46 = @predecexpr
+| 47 = @minusexpr
+| 48 = @plusexpr
+| 49 = @bitnotexpr
+| 50 = @lognotexpr
+| 51 = @castexpr
+| 52 = @newexpr
+| 53 = @conditionalexpr
+| 54 = @parexpr // deprecated
+| 55 = @instanceofexpr
+| 56 = @localvariabledeclexpr
+| 57 = @typeliteral
+| 58 = @thisaccess
+| 59 = @superaccess
+| 60 = @varaccess
+| 61 = @methodaccess
+| 62 = @unannotatedtypeaccess
+| 63 = @arraytypeaccess
+| 64 = @packageaccess
+| 65 = @wildcardtypeaccess
+| 66 = @declannotation
+| 67 = @uniontypeaccess
+| 68 = @lambdaexpr
+| 69 = @memberref
+| 70 = @annotatedtypeaccess
+| 71 = @typeannotation
+| 72 = @intersectiontypeaccess
+| 73 = @switchexpr
+| 74 = @errorexpr
+| 75 = @whenexpr
+| 76 = @getclassexpr
+| 77 = @safecastexpr
+| 78 = @implicitcastexpr
+| 79 = @implicitnotnullexpr
+| 80 = @implicitcoerciontounitexpr
+| 81 = @notinstanceofexpr
+| 82 = @stmtexpr
+| 83 = @stringtemplateexpr
+| 84 = @notnullexpr
+| 85 = @unsafecoerceexpr
+| 86 = @valueeqexpr
+| 87 = @valueneexpr
+| 88 = @propertyref
+;
+
+/** Holds if this `when` expression was written as an `if` expression. */
+when_if(unique int id: @whenexpr ref);
+
+/** Holds if this `when` branch was written as an `else` branch. */
+when_branch_else(unique int id: @whenbranch ref);
+
+@classinstancexpr = @newexpr | @lambdaexpr | @memberref | @propertyref
+
+@annotation = @declannotation | @typeannotation
+@typeaccess = @unannotatedtypeaccess | @annotatedtypeaccess
+
+@assignment = @assignexpr
+ | @assignop;
+
+@unaryassignment = @postincexpr
+ | @postdecexpr
+ | @preincexpr
+ | @predecexpr;
+
+@assignop = @assignaddexpr
+ | @assignsubexpr
+ | @assignmulexpr
+ | @assigndivexpr
+ | @assignremexpr
+ | @assignandexpr
+ | @assignorexpr
+ | @assignxorexpr
+ | @assignlshiftexpr
+ | @assignrshiftexpr
+ | @assignurshiftexpr;
+
+@literal = @booleanliteral
+ | @integerliteral
+ | @longliteral
+ | @floatingpointliteral
+ | @doubleliteral
+ | @characterliteral
+ | @stringliteral
+ | @nullliteral;
+
+@binaryexpr = @mulexpr
+ | @divexpr
+ | @remexpr
+ | @addexpr
+ | @subexpr
+ | @lshiftexpr
+ | @rshiftexpr
+ | @urshiftexpr
+ | @andbitexpr
+ | @orbitexpr
+ | @xorbitexpr
+ | @andlogicalexpr
+ | @orlogicalexpr
+ | @ltexpr
+ | @gtexpr
+ | @leexpr
+ | @geexpr
+ | @eqexpr
+ | @neexpr
+ | @valueeqexpr
+ | @valueneexpr;
+
+@unaryexpr = @postincexpr
+ | @postdecexpr
+ | @preincexpr
+ | @predecexpr
+ | @minusexpr
+ | @plusexpr
+ | @bitnotexpr
+ | @lognotexpr
+ | @notnullexpr;
+
+@caller = @classinstancexpr
+ | @methodaccess
+ | @constructorinvocationstmt
+ | @superconstructorinvocationstmt;
+
+callableBinding(
+ unique int callerid: @caller ref,
+ int callee: @callable ref
+);
+
+memberRefBinding(
+ unique int id: @expr ref,
+ int callable: @callable ref
+);
+
+propertyRefGetBinding(
+ unique int id: @expr ref,
+ int getter: @callable ref
+);
+
+propertyRefFieldBinding(
+ unique int id: @expr ref,
+ int field: @field ref
+);
+
+propertyRefSetBinding(
+ unique int id: @expr ref,
+ int setter: @callable ref
+);
+
+@exprparent = @stmt | @expr | @whenbranch | @callable | @field | @fielddecl | @class | @interface | @param | @localvar | @typevariable;
+
+variableBinding(
+ unique int expr: @varaccess ref,
+ int variable: @variable ref
+);
+
+@variable = @localscopevariable | @field;
+
+@localscopevariable = @localvar | @param;
+
+localvars(
+ unique int id: @localvar,
+ string nodeName: string ref,
+ int typeid: @type ref,
+ int parentid: @localvariabledeclexpr ref
+);
+
+localvarsKotlinType(
+ unique int id: @localvar ref,
+ int kttypeid: @kt_type ref
+);
+
+@namedexprorstmt = @breakstmt
+ | @continuestmt
+ | @labeledstmt
+ | @literal;
+
+namestrings(
+ string name: string ref,
+ string value: string ref,
+ unique int parent: @namedexprorstmt ref
+);
+
+/*
+ * Modules
+ */
+
+#keyset[name]
+modules(
+ unique int id: @module,
+ string name: string ref
+);
+
+isOpen(
+ int id: @module ref
+);
+
+#keyset[fileId]
+cumodule(
+ int fileId: @file ref,
+ int moduleId: @module ref
+);
+
+@directive = @requires
+ | @exports
+ | @opens
+ | @uses
+ | @provides
+
+#keyset[directive]
+directives(
+ int id: @module ref,
+ int directive: @directive ref
+);
+
+requires(
+ unique int id: @requires,
+ int target: @module ref
+);
+
+isTransitive(
+ int id: @requires ref
+);
+
+isStatic(
+ int id: @requires ref
+);
+
+exports(
+ unique int id: @exports,
+ int target: @package ref
+);
+
+exportsTo(
+ int id: @exports ref,
+ int target: @module ref
+);
+
+opens(
+ unique int id: @opens,
+ int target: @package ref
+);
+
+opensTo(
+ int id: @opens ref,
+ int target: @module ref
+);
+
+uses(
+ unique int id: @uses,
+ string serviceInterface: string ref
+);
+
+provides(
+ unique int id: @provides,
+ string serviceInterface: string ref
+);
+
+providesWith(
+ int id: @provides ref,
+ string serviceImpl: string ref
+);
+
+/*
+ * Javadoc
+ */
+
+javadoc(
+ unique int id: @javadoc
+);
+
+isNormalComment(
+ int commentid : @javadoc ref
+);
+
+isEolComment(
+ int commentid : @javadoc ref
+);
+
+hasJavadoc(
+ int documentableid: @member ref,
+ int javadocid: @javadoc ref
+);
+
+#keyset[parentid,idx]
+javadocTag(
+ unique int id: @javadocTag,
+ string name: string ref,
+ int parentid: @javadocParent ref,
+ int idx: int ref
+);
+
+#keyset[parentid,idx]
+javadocText(
+ unique int id: @javadocText,
+ string text: string ref,
+ int parentid: @javadocParent ref,
+ int idx: int ref
+);
+
+@javadocParent = @javadoc | @javadocTag;
+@javadocElement = @javadocTag | @javadocText;
+
+@classorinterface = @interface | @class;
+@classorinterfaceorpackage = @classorinterface | @package;
+@classorinterfaceorcallable = @classorinterface | @callable;
+@boundedtype = @typevariable | @wildcard;
+@reftype = @classorinterface | @array | @boundedtype | @errortype;
+@classorarray = @class | @array;
+@type = @primitive | @reftype;
+@callable = @method | @constructor;
+
+/** A program element that has a name. */
+@element = @package | @modifier | @annotation | @errortype |
+ @locatableElement;
+
+@locatableElement = @file | @primitive | @class | @interface | @method | @constructor | @param | @exception | @field |
+ @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl | @kt_type | @kt_type_alias |
+ @kt_property;
+
+@modifiable = @member_modifiable| @param | @localvar | @typevariable;
+
+@member_modifiable = @class | @interface | @method | @constructor | @field | @kt_property;
+
+@member = @method | @constructor | @field | @reftype ;
+
+/** A program element that has a location. */
+@locatable = @typebound | @javadoc | @javadocTag | @javadocText | @xmllocatable | @ktcomment |
+ @locatableElement;
+
+@top = @element | @locatable | @folder;
+
+/*
+ * XML Files
+ */
+
+xmlEncoding(
+ unique int id: @file ref,
+ string encoding: string ref
+);
+
+xmlDTDs(
+ unique int id: @xmldtd,
+ string root: string ref,
+ string publicId: string ref,
+ string systemId: string ref,
+ int fileid: @file ref
+);
+
+xmlElements(
+ unique int id: @xmlelement,
+ string name: string ref,
+ int parentid: @xmlparent ref,
+ int idx: int ref,
+ int fileid: @file ref
+);
+
+xmlAttrs(
+ unique int id: @xmlattribute,
+ int elementid: @xmlelement ref,
+ string name: string ref,
+ string value: string ref,
+ int idx: int ref,
+ int fileid: @file ref
+);
+
+xmlNs(
+ int id: @xmlnamespace,
+ string prefixName: string ref,
+ string URI: string ref,
+ int fileid: @file ref
+);
+
+xmlHasNs(
+ int elementId: @xmlnamespaceable ref,
+ int nsId: @xmlnamespace ref,
+ int fileid: @file ref
+);
+
+xmlComments(
+ unique int id: @xmlcomment,
+ string text: string ref,
+ int parentid: @xmlparent ref,
+ int fileid: @file ref
+);
+
+xmlChars(
+ unique int id: @xmlcharacters,
+ string text: string ref,
+ int parentid: @xmlparent ref,
+ int idx: int ref,
+ int isCDATA: int ref,
+ int fileid: @file ref
+);
+
+@xmlparent = @file | @xmlelement;
+@xmlnamespaceable = @xmlelement | @xmlattribute;
+
+xmllocations(
+ int xmlElement: @xmllocatable ref,
+ int location: @location_default ref
+);
+
+@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
+
+/*
+ * configuration files with key value pairs
+ */
+
+configs(
+ unique int id: @config
+);
+
+configNames(
+ unique int id: @configName,
+ int config: @config ref,
+ string name: string ref
+);
+
+configValues(
+ unique int id: @configValue,
+ int config: @config ref,
+ string value: string ref
+);
+
+configLocations(
+ int locatable: @configLocatable ref,
+ int location: @location_default ref
+);
+
+@configLocatable = @config | @configName | @configValue;
+
+ktComments(
+ unique int id: @ktcomment,
+ int kind: int ref,
+ string text : string ref
+)
+
+ktCommentSections(
+ unique int id: @ktcommentsection,
+ int comment: @ktcomment ref,
+ string content : string ref
+)
+
+ktCommentSectionNames(
+ unique int id: @ktcommentsection ref,
+ string name : string ref
+)
+
+ktCommentSectionSubjectNames(
+ unique int id: @ktcommentsection ref,
+ string subjectname : string ref
+)
+
+#keyset[id, owner]
+ktCommentOwners(
+ int id: @ktcomment ref,
+ int owner: @top ref
+)
+
+ktExtensionFunctions(
+ unique int id: @method ref,
+ int typeid: @type ref,
+ int kttypeid: @kt_type ref
+)
+
+ktProperties(
+ unique int id: @kt_property,
+ string nodeName: string ref
+)
+
+ktPropertyGetters(
+ unique int id: @kt_property ref,
+ int getter: @method ref
+)
+
+ktPropertySetters(
+ unique int id: @kt_property ref,
+ int setter: @method ref
+)
+
+ktPropertyBackingFields(
+ unique int id: @kt_property ref,
+ int backingField: @field ref
+)
+
+ktSyntheticBody(
+ unique int id: @callable ref,
+ int kind: int ref
+ // 1: ENUM_VALUES
+ // 2: ENUM_VALUEOF
+)
+
+ktLocalFunction(
+ unique int id: @method ref
+)
+
+ktInitializerAssignment(
+ unique int id: @assignexpr ref
+)
+
+ktPropertyDelegates(
+ unique int id: @kt_property ref,
+ unique int variableId: @variable ref
+)
+
+/**
+ * If `id` is a compiler generated element, then the kind indicates the
+ * reason that the compiler generated it.
+ * See `Element.compilerGeneratedReason()` for an explanation of what
+ * each `kind` means.
+ */
+compiler_generated(
+ unique int id: @element ref,
+ int kind: int ref
+)
+
+ktFunctionOriginalNames(
+ unique int id: @method ref,
+ string name: string ref
+)
+
+ktDataClasses(
+ unique int id: @class ref
+)
diff --git a/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/semmlecode.dbscheme b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/semmlecode.dbscheme
new file mode 100644
index 00000000000..ecb42310286
--- /dev/null
+++ b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/semmlecode.dbscheme
@@ -0,0 +1,1240 @@
+/**
+ * An invocation of the compiler. Note that more than one file may be
+ * compiled per invocation. For example, this command compiles three
+ * source files:
+ *
+ * javac A.java B.java C.java
+ *
+ * The `id` simply identifies the invocation, while `cwd` is the working
+ * directory from which the compiler was invoked.
+ */
+compilations(
+ /**
+ * An invocation of the compiler. Note that more than one file may
+ * be compiled per invocation. For example, this command compiles
+ * three source files:
+ *
+ * javac A.java B.java C.java
+ */
+ unique int id : @compilation,
+ int kind: int ref,
+ string cwd : string ref,
+ string name : string ref
+);
+
+case @compilation.kind of
+ 1 = @javacompilation
+| 2 = @kotlincompilation
+;
+
+compilation_started(
+ int id : @compilation ref
+)
+
+/**
+ * The arguments that were passed to the extractor for a compiler
+ * invocation. If `id` is for the compiler invocation
+ *
+ * javac A.java B.java C.java
+ *
+ * then typically there will be rows for
+ *
+ * num | arg
+ * --- | ---
+ * 0 | *path to extractor*
+ * 1 | `--javac-args`
+ * 2 | A.java
+ * 3 | B.java
+ * 4 | C.java
+ */
+#keyset[id, num]
+compilation_args(
+ int id : @compilation ref,
+ int num : int ref,
+ string arg : string ref
+);
+
+/**
+ * The source files that are compiled by a compiler invocation.
+ * If `id` is for the compiler invocation
+ *
+ * javac A.java B.java C.java
+ *
+ * then there will be rows for
+ *
+ * num | arg
+ * --- | ---
+ * 0 | A.java
+ * 1 | B.java
+ * 2 | C.java
+ */
+#keyset[id, num]
+compilation_compiling_files(
+ int id : @compilation ref,
+ int num : int ref,
+ int file : @file ref
+);
+
+/**
+ * For each file recorded in `compilation_compiling_files`,
+ * there will be a corresponding row in
+ * `compilation_compiling_files_completed` once extraction
+ * of that file is complete. The `result` will indicate the
+ * extraction result:
+ *
+ * 0: Successfully extracted
+ * 1: Errors were encountered, but extraction recovered
+ * 2: Errors were encountered, and extraction could not recover
+ */
+#keyset[id, num]
+compilation_compiling_files_completed(
+ int id : @compilation ref,
+ int num : int ref,
+ int result : int ref
+);
+
+/**
+ * The time taken by the extractor for a compiler invocation.
+ *
+ * For each file `num`, there will be rows for
+ *
+ * kind | seconds
+ * ---- | ---
+ * 1 | CPU seconds used by the extractor frontend
+ * 2 | Elapsed seconds during the extractor frontend
+ * 3 | CPU seconds used by the extractor backend
+ * 4 | Elapsed seconds during the extractor backend
+ */
+#keyset[id, num, kind]
+compilation_time(
+ int id : @compilation ref,
+ int num : int ref,
+ /* kind:
+ 1 = frontend_cpu_seconds
+ 2 = frontend_elapsed_seconds
+ 3 = extractor_cpu_seconds
+ 4 = extractor_elapsed_seconds
+ */
+ int kind : int ref,
+ float seconds : float ref
+);
+
+/**
+ * An error or warning generated by the extractor.
+ * The diagnostic message `diagnostic` was generated during compiler
+ * invocation `compilation`, and is the `file_number_diagnostic_number`th
+ * message generated while extracting the `file_number`th file of that
+ * invocation.
+ */
+#keyset[compilation, file_number, file_number_diagnostic_number]
+diagnostic_for(
+ unique int diagnostic : @diagnostic ref,
+ int compilation : @compilation ref,
+ int file_number : int ref,
+ int file_number_diagnostic_number : int ref
+);
+
+/**
+ * The `cpu_seconds` and `elapsed_seconds` are the CPU time and elapsed
+ * time (respectively) that the original compilation (not the extraction)
+ * took for compiler invocation `id`.
+ */
+compilation_compiler_times(
+ unique int id : @compilation ref,
+ float cpu_seconds : float ref,
+ float elapsed_seconds : float ref
+);
+
+/**
+ * If extraction was successful, then `cpu_seconds` and
+ * `elapsed_seconds` are the CPU time and elapsed time (respectively)
+ * that extraction took for compiler invocation `id`.
+ * The `result` will indicate the extraction result:
+ *
+ * 0: Successfully extracted
+ * 1: Errors were encountered, but extraction recovered
+ * 2: Errors were encountered, and extraction could not recover
+ */
+compilation_finished(
+ unique int id : @compilation ref,
+ float cpu_seconds : float ref,
+ float elapsed_seconds : float ref,
+ int result : int ref
+);
+
+diagnostics(
+ unique int id: @diagnostic,
+ string generated_by: string ref, // TODO: Sync this with the other languages?
+ int severity: int ref,
+ string error_tag: string ref,
+ string error_message: string ref,
+ string full_error_message: string ref,
+ int location: @location_default ref
+);
+
+/*
+ * External artifacts
+ */
+
+externalData(
+ int id : @externalDataElement,
+ string path : string ref,
+ int column: int ref,
+ string value : string ref
+);
+
+snapshotDate(
+ unique date snapshotDate : date ref
+);
+
+sourceLocationPrefix(
+ string prefix : string ref
+);
+
+/*
+ * Duplicate code
+ */
+
+duplicateCode(
+ unique int id : @duplication,
+ string relativePath : string ref,
+ int equivClass : int ref
+);
+
+similarCode(
+ unique int id : @similarity,
+ string relativePath : string ref,
+ int equivClass : int ref
+);
+
+@duplication_or_similarity = @duplication | @similarity
+
+tokens(
+ int id : @duplication_or_similarity ref,
+ int offset : int ref,
+ int beginLine : int ref,
+ int beginColumn : int ref,
+ int endLine : int ref,
+ int endColumn : int ref
+);
+
+/*
+ * SMAP
+ */
+
+smap_header(
+ int outputFileId: @file ref,
+ string outputFilename: string ref,
+ string defaultStratum: string ref
+);
+
+smap_files(
+ int outputFileId: @file ref,
+ string stratum: string ref,
+ int inputFileNum: int ref,
+ string inputFileName: string ref,
+ int inputFileId: @file ref
+);
+
+smap_lines(
+ int outputFileId: @file ref,
+ string stratum: string ref,
+ int inputFileNum: int ref,
+ int inputStartLine: int ref,
+ int inputLineCount: int ref,
+ int outputStartLine: int ref,
+ int outputLineIncrement: int ref
+);
+
+/*
+ * Locations and files
+ */
+
+@location = @location_default ;
+
+locations_default(
+ unique int id: @location_default,
+ int file: @file ref,
+ int beginLine: int ref,
+ int beginColumn: int ref,
+ int endLine: int ref,
+ int endColumn: int ref
+);
+
+hasLocation(
+ int locatableid: @locatable ref,
+ int id: @location ref
+);
+
+@sourceline = @locatable ;
+
+#keyset[element_id]
+numlines(
+ int element_id: @sourceline ref,
+ int num_lines: int ref,
+ int num_code: int ref,
+ int num_comment: int ref
+);
+
+files(
+ unique int id: @file,
+ string name: string ref
+);
+
+folders(
+ unique int id: @folder,
+ string name: string ref
+);
+
+@container = @folder | @file
+
+containerparent(
+ int parent: @container ref,
+ unique int child: @container ref
+);
+
+/*
+ * Java
+ */
+
+cupackage(
+ unique int id: @file ref,
+ int packageid: @package ref
+);
+
+#keyset[fileid,keyName]
+jarManifestMain(
+ int fileid: @file ref,
+ string keyName: string ref,
+ string value: string ref
+);
+
+#keyset[fileid,entryName,keyName]
+jarManifestEntries(
+ int fileid: @file ref,
+ string entryName: string ref,
+ string keyName: string ref,
+ string value: string ref
+);
+
+packages(
+ unique int id: @package,
+ string nodeName: string ref
+);
+
+primitives(
+ unique int id: @primitive,
+ string nodeName: string ref
+);
+
+modifiers(
+ unique int id: @modifier,
+ string nodeName: string ref
+);
+
+/**
+ * An errortype is used when the extractor is unable to extract a type
+ * correctly for some reason.
+ */
+error_type(
+ unique int id: @errortype
+);
+
+classes(
+ unique int id: @class,
+ string nodeName: string ref,
+ int parentid: @package ref,
+ int sourceid: @class ref
+);
+
+file_class(
+ int id: @class ref
+);
+
+class_object(
+ unique int id: @class ref,
+ unique int instance: @field ref
+);
+
+type_companion_object(
+ unique int id: @classorinterface ref,
+ unique int instance: @field ref,
+ unique int companion_object: @class ref
+);
+
+kt_nullable_types(
+ unique int id: @kt_nullable_type,
+ int classid: @reftype ref
+)
+
+kt_notnull_types(
+ unique int id: @kt_notnull_type,
+ int classid: @reftype ref
+)
+
+kt_type_alias(
+ unique int id: @kt_type_alias,
+ string name: string ref,
+ int kttypeid: @kt_type ref
+)
+
+@kt_type = @kt_nullable_type | @kt_notnull_type
+
+isRecord(
+ unique int id: @class ref
+);
+
+interfaces(
+ unique int id: @interface,
+ string nodeName: string ref,
+ int parentid: @package ref,
+ int sourceid: @interface ref
+);
+
+fielddecls(
+ unique int id: @fielddecl,
+ int parentid: @reftype ref
+);
+
+#keyset[fieldId] #keyset[fieldDeclId,pos]
+fieldDeclaredIn(
+ int fieldId: @field ref,
+ int fieldDeclId: @fielddecl ref,
+ int pos: int ref
+);
+
+fields(
+ unique int id: @field,
+ string nodeName: string ref,
+ int typeid: @type ref,
+ int parentid: @reftype ref,
+ int sourceid: @field ref
+);
+
+fieldsKotlinType(
+ unique int id: @field ref,
+ int kttypeid: @kt_type ref
+);
+
+constrs(
+ unique int id: @constructor,
+ string nodeName: string ref,
+ string signature: string ref,
+ int typeid: @type ref,
+ int parentid: @reftype ref,
+ int sourceid: @constructor ref
+);
+
+constrsKotlinType(
+ unique int id: @constructor ref,
+ int kttypeid: @kt_type ref
+);
+
+methods(
+ unique int id: @method,
+ string nodeName: string ref,
+ string signature: string ref,
+ int typeid: @type ref,
+ int parentid: @reftype ref,
+ int sourceid: @method ref
+);
+
+methodsKotlinType(
+ unique int id: @method ref,
+ int kttypeid: @kt_type ref
+);
+
+#keyset[parentid,pos]
+params(
+ unique int id: @param,
+ int typeid: @type ref,
+ int pos: int ref,
+ int parentid: @callable ref,
+ int sourceid: @param ref
+);
+
+paramsKotlinType(
+ unique int id: @param ref,
+ int kttypeid: @kt_type ref
+);
+
+paramName(
+ unique int id: @param ref,
+ string nodeName: string ref
+);
+
+isVarargsParam(
+ int param: @param ref
+);
+
+exceptions(
+ unique int id: @exception,
+ int typeid: @type ref,
+ int parentid: @callable ref
+);
+
+isAnnotType(
+ int interfaceid: @interface ref
+);
+
+isAnnotElem(
+ int methodid: @method ref
+);
+
+annotValue(
+ int parentid: @annotation ref,
+ int id2: @method ref,
+ unique int value: @expr ref
+);
+
+isEnumType(
+ int classid: @class ref
+);
+
+isEnumConst(
+ int fieldid: @field ref
+);
+
+#keyset[parentid,pos]
+typeVars(
+ unique int id: @typevariable,
+ string nodeName: string ref,
+ int pos: int ref,
+ int kind: int ref, // deprecated
+ int parentid: @classorinterfaceorcallable ref
+);
+
+wildcards(
+ unique int id: @wildcard,
+ string nodeName: string ref,
+ int kind: int ref
+);
+
+#keyset[parentid,pos]
+typeBounds(
+ unique int id: @typebound,
+ int typeid: @reftype ref,
+ int pos: int ref,
+ int parentid: @boundedtype ref
+);
+
+#keyset[parentid,pos]
+typeArgs(
+ int argumentid: @reftype ref,
+ int pos: int ref,
+ int parentid: @classorinterfaceorcallable ref
+);
+
+isParameterized(
+ int memberid: @member ref
+);
+
+isRaw(
+ int memberid: @member ref
+);
+
+erasure(
+ unique int memberid: @member ref,
+ int erasureid: @member ref
+);
+
+#keyset[classid] #keyset[parent]
+isAnonymClass(
+ int classid: @class ref,
+ int parent: @classinstancexpr ref
+);
+
+#keyset[typeid] #keyset[parent]
+isLocalClassOrInterface(
+ int typeid: @classorinterface ref,
+ int parent: @localtypedeclstmt ref
+);
+
+isDefConstr(
+ int constructorid: @constructor ref
+);
+
+#keyset[exprId]
+lambdaKind(
+ int exprId: @lambdaexpr ref,
+ int bodyKind: int ref
+);
+
+arrays(
+ unique int id: @array,
+ string nodeName: string ref,
+ int elementtypeid: @type ref,
+ int dimension: int ref,
+ int componenttypeid: @type ref
+);
+
+enclInReftype(
+ unique int child: @reftype ref,
+ int parent: @reftype ref
+);
+
+extendsReftype(
+ int id1: @reftype ref,
+ int id2: @classorinterface ref
+);
+
+implInterface(
+ int id1: @classorarray ref,
+ int id2: @interface ref
+);
+
+permits(
+ int id1: @classorinterface ref,
+ int id2: @classorinterface ref
+);
+
+hasModifier(
+ int id1: @modifiable ref,
+ int id2: @modifier ref
+);
+
+imports(
+ unique int id: @import,
+ int holder: @classorinterfaceorpackage ref,
+ string name: string ref,
+ int kind: int ref
+);
+
+#keyset[parent,idx]
+stmts(
+ unique int id: @stmt,
+ int kind: int ref,
+ int parent: @stmtparent ref,
+ int idx: int ref,
+ int bodydecl: @callable ref
+);
+
+@stmtparent = @callable | @stmt | @switchexpr | @whenexpr| @stmtexpr;
+
+case @stmt.kind of
+ 0 = @block
+| 1 = @ifstmt
+| 2 = @forstmt
+| 3 = @enhancedforstmt
+| 4 = @whilestmt
+| 5 = @dostmt
+| 6 = @trystmt
+| 7 = @switchstmt
+| 8 = @synchronizedstmt
+| 9 = @returnstmt
+| 10 = @throwstmt
+| 11 = @breakstmt
+| 12 = @continuestmt
+| 13 = @emptystmt
+| 14 = @exprstmt
+| 15 = @labeledstmt
+| 16 = @assertstmt
+| 17 = @localvariabledeclstmt
+| 18 = @localtypedeclstmt
+| 19 = @constructorinvocationstmt
+| 20 = @superconstructorinvocationstmt
+| 21 = @case
+| 22 = @catchclause
+| 23 = @yieldstmt
+| 24 = @errorstmt
+| 25 = @whenbranch
+;
+
+#keyset[parent,idx]
+exprs(
+ unique int id: @expr,
+ int kind: int ref,
+ int typeid: @type ref,
+ int parent: @exprparent ref,
+ int idx: int ref
+);
+
+exprsKotlinType(
+ unique int id: @expr ref,
+ int kttypeid: @kt_type ref
+);
+
+callableEnclosingExpr(
+ unique int id: @expr ref,
+ int callable_id: @callable ref
+);
+
+statementEnclosingExpr(
+ unique int id: @expr ref,
+ int statement_id: @stmt ref
+);
+
+isParenthesized(
+ unique int id: @expr ref,
+ int parentheses: int ref
+);
+
+case @expr.kind of
+ 1 = @arrayaccess
+| 2 = @arraycreationexpr
+| 3 = @arrayinit
+| 4 = @assignexpr
+| 5 = @assignaddexpr
+| 6 = @assignsubexpr
+| 7 = @assignmulexpr
+| 8 = @assigndivexpr
+| 9 = @assignremexpr
+| 10 = @assignandexpr
+| 11 = @assignorexpr
+| 12 = @assignxorexpr
+| 13 = @assignlshiftexpr
+| 14 = @assignrshiftexpr
+| 15 = @assignurshiftexpr
+| 16 = @booleanliteral
+| 17 = @integerliteral
+| 18 = @longliteral
+| 19 = @floatingpointliteral
+| 20 = @doubleliteral
+| 21 = @characterliteral
+| 22 = @stringliteral
+| 23 = @nullliteral
+| 24 = @mulexpr
+| 25 = @divexpr
+| 26 = @remexpr
+| 27 = @addexpr
+| 28 = @subexpr
+| 29 = @lshiftexpr
+| 30 = @rshiftexpr
+| 31 = @urshiftexpr
+| 32 = @andbitexpr
+| 33 = @orbitexpr
+| 34 = @xorbitexpr
+| 35 = @andlogicalexpr
+| 36 = @orlogicalexpr
+| 37 = @ltexpr
+| 38 = @gtexpr
+| 39 = @leexpr
+| 40 = @geexpr
+| 41 = @eqexpr
+| 42 = @neexpr
+| 43 = @postincexpr
+| 44 = @postdecexpr
+| 45 = @preincexpr
+| 46 = @predecexpr
+| 47 = @minusexpr
+| 48 = @plusexpr
+| 49 = @bitnotexpr
+| 50 = @lognotexpr
+| 51 = @castexpr
+| 52 = @newexpr
+| 53 = @conditionalexpr
+| 54 = @parexpr // deprecated
+| 55 = @instanceofexpr
+| 56 = @localvariabledeclexpr
+| 57 = @typeliteral
+| 58 = @thisaccess
+| 59 = @superaccess
+| 60 = @varaccess
+| 61 = @methodaccess
+| 62 = @unannotatedtypeaccess
+| 63 = @arraytypeaccess
+| 64 = @packageaccess
+| 65 = @wildcardtypeaccess
+| 66 = @declannotation
+| 67 = @uniontypeaccess
+| 68 = @lambdaexpr
+| 69 = @memberref
+| 70 = @annotatedtypeaccess
+| 71 = @typeannotation
+| 72 = @intersectiontypeaccess
+| 73 = @switchexpr
+| 74 = @errorexpr
+| 75 = @whenexpr
+| 76 = @getclassexpr
+| 77 = @safecastexpr
+| 78 = @implicitcastexpr
+| 79 = @implicitnotnullexpr
+| 80 = @implicitcoerciontounitexpr
+| 81 = @notinstanceofexpr
+| 82 = @stmtexpr
+| 83 = @stringtemplateexpr
+| 84 = @notnullexpr
+| 85 = @unsafecoerceexpr
+| 86 = @valueeqexpr
+| 87 = @valueneexpr
+| 88 = @propertyref
+;
+
+/** Holds if this `when` expression was written as an `if` expression. */
+when_if(unique int id: @whenexpr ref);
+
+/** Holds if this `when` branch was written as an `else` branch. */
+when_branch_else(unique int id: @whenbranch ref);
+
+@classinstancexpr = @newexpr | @lambdaexpr | @memberref | @propertyref
+
+@annotation = @declannotation | @typeannotation
+@typeaccess = @unannotatedtypeaccess | @annotatedtypeaccess
+
+@assignment = @assignexpr
+ | @assignop;
+
+@unaryassignment = @postincexpr
+ | @postdecexpr
+ | @preincexpr
+ | @predecexpr;
+
+@assignop = @assignaddexpr
+ | @assignsubexpr
+ | @assignmulexpr
+ | @assigndivexpr
+ | @assignremexpr
+ | @assignandexpr
+ | @assignorexpr
+ | @assignxorexpr
+ | @assignlshiftexpr
+ | @assignrshiftexpr
+ | @assignurshiftexpr;
+
+@literal = @booleanliteral
+ | @integerliteral
+ | @longliteral
+ | @floatingpointliteral
+ | @doubleliteral
+ | @characterliteral
+ | @stringliteral
+ | @nullliteral;
+
+@binaryexpr = @mulexpr
+ | @divexpr
+ | @remexpr
+ | @addexpr
+ | @subexpr
+ | @lshiftexpr
+ | @rshiftexpr
+ | @urshiftexpr
+ | @andbitexpr
+ | @orbitexpr
+ | @xorbitexpr
+ | @andlogicalexpr
+ | @orlogicalexpr
+ | @ltexpr
+ | @gtexpr
+ | @leexpr
+ | @geexpr
+ | @eqexpr
+ | @neexpr
+ | @valueeqexpr
+ | @valueneexpr;
+
+@unaryexpr = @postincexpr
+ | @postdecexpr
+ | @preincexpr
+ | @predecexpr
+ | @minusexpr
+ | @plusexpr
+ | @bitnotexpr
+ | @lognotexpr
+ | @notnullexpr;
+
+@caller = @classinstancexpr
+ | @methodaccess
+ | @constructorinvocationstmt
+ | @superconstructorinvocationstmt;
+
+callableBinding(
+ unique int callerid: @caller ref,
+ int callee: @callable ref
+);
+
+memberRefBinding(
+ unique int id: @expr ref,
+ int callable: @callable ref
+);
+
+propertyRefGetBinding(
+ unique int id: @expr ref,
+ int getter: @callable ref
+);
+
+propertyRefFieldBinding(
+ unique int id: @expr ref,
+ int field: @field ref
+);
+
+propertyRefSetBinding(
+ unique int id: @expr ref,
+ int setter: @callable ref
+);
+
+@exprparent = @stmt | @expr | @whenbranch | @callable | @field | @fielddecl | @class | @interface | @param | @localvar | @typevariable;
+
+variableBinding(
+ unique int expr: @varaccess ref,
+ int variable: @variable ref
+);
+
+@variable = @localscopevariable | @field;
+
+@localscopevariable = @localvar | @param;
+
+localvars(
+ unique int id: @localvar,
+ string nodeName: string ref,
+ int typeid: @type ref,
+ int parentid: @localvariabledeclexpr ref
+);
+
+localvarsKotlinType(
+ unique int id: @localvar ref,
+ int kttypeid: @kt_type ref
+);
+
+@namedexprorstmt = @breakstmt
+ | @continuestmt
+ | @labeledstmt
+ | @literal;
+
+namestrings(
+ string name: string ref,
+ string value: string ref,
+ unique int parent: @namedexprorstmt ref
+);
+
+/*
+ * Modules
+ */
+
+#keyset[name]
+modules(
+ unique int id: @module,
+ string name: string ref
+);
+
+isOpen(
+ int id: @module ref
+);
+
+#keyset[fileId]
+cumodule(
+ int fileId: @file ref,
+ int moduleId: @module ref
+);
+
+@directive = @requires
+ | @exports
+ | @opens
+ | @uses
+ | @provides
+
+#keyset[directive]
+directives(
+ int id: @module ref,
+ int directive: @directive ref
+);
+
+requires(
+ unique int id: @requires,
+ int target: @module ref
+);
+
+isTransitive(
+ int id: @requires ref
+);
+
+isStatic(
+ int id: @requires ref
+);
+
+exports(
+ unique int id: @exports,
+ int target: @package ref
+);
+
+exportsTo(
+ int id: @exports ref,
+ int target: @module ref
+);
+
+opens(
+ unique int id: @opens,
+ int target: @package ref
+);
+
+opensTo(
+ int id: @opens ref,
+ int target: @module ref
+);
+
+uses(
+ unique int id: @uses,
+ string serviceInterface: string ref
+);
+
+provides(
+ unique int id: @provides,
+ string serviceInterface: string ref
+);
+
+providesWith(
+ int id: @provides ref,
+ string serviceImpl: string ref
+);
+
+/*
+ * Javadoc
+ */
+
+javadoc(
+ unique int id: @javadoc
+);
+
+isNormalComment(
+ int commentid : @javadoc ref
+);
+
+isEolComment(
+ int commentid : @javadoc ref
+);
+
+hasJavadoc(
+ int documentableid: @member ref,
+ int javadocid: @javadoc ref
+);
+
+#keyset[parentid,idx]
+javadocTag(
+ unique int id: @javadocTag,
+ string name: string ref,
+ int parentid: @javadocParent ref,
+ int idx: int ref
+);
+
+#keyset[parentid,idx]
+javadocText(
+ unique int id: @javadocText,
+ string text: string ref,
+ int parentid: @javadocParent ref,
+ int idx: int ref
+);
+
+@javadocParent = @javadoc | @javadocTag;
+@javadocElement = @javadocTag | @javadocText;
+
+@classorinterface = @interface | @class;
+@classorinterfaceorpackage = @classorinterface | @package;
+@classorinterfaceorcallable = @classorinterface | @callable;
+@boundedtype = @typevariable | @wildcard;
+@reftype = @classorinterface | @array | @boundedtype | @errortype;
+@classorarray = @class | @array;
+@type = @primitive | @reftype;
+@callable = @method | @constructor;
+
+/** A program element that has a name. */
+@element = @package | @modifier | @annotation | @errortype |
+ @locatableElement;
+
+@locatableElement = @file | @primitive | @class | @interface | @method | @constructor | @param | @exception | @field |
+ @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl | @kt_type | @kt_type_alias |
+ @kt_property;
+
+@modifiable = @member_modifiable| @param | @localvar ;
+
+@member_modifiable = @class | @interface | @method | @constructor | @field | @kt_property;
+
+@member = @method | @constructor | @field | @reftype ;
+
+/** A program element that has a location. */
+@locatable = @typebound | @javadoc | @javadocTag | @javadocText | @xmllocatable | @ktcomment |
+ @locatableElement;
+
+@top = @element | @locatable | @folder;
+
+/*
+ * XML Files
+ */
+
+xmlEncoding(
+ unique int id: @file ref,
+ string encoding: string ref
+);
+
+xmlDTDs(
+ unique int id: @xmldtd,
+ string root: string ref,
+ string publicId: string ref,
+ string systemId: string ref,
+ int fileid: @file ref
+);
+
+xmlElements(
+ unique int id: @xmlelement,
+ string name: string ref,
+ int parentid: @xmlparent ref,
+ int idx: int ref,
+ int fileid: @file ref
+);
+
+xmlAttrs(
+ unique int id: @xmlattribute,
+ int elementid: @xmlelement ref,
+ string name: string ref,
+ string value: string ref,
+ int idx: int ref,
+ int fileid: @file ref
+);
+
+xmlNs(
+ int id: @xmlnamespace,
+ string prefixName: string ref,
+ string URI: string ref,
+ int fileid: @file ref
+);
+
+xmlHasNs(
+ int elementId: @xmlnamespaceable ref,
+ int nsId: @xmlnamespace ref,
+ int fileid: @file ref
+);
+
+xmlComments(
+ unique int id: @xmlcomment,
+ string text: string ref,
+ int parentid: @xmlparent ref,
+ int fileid: @file ref
+);
+
+xmlChars(
+ unique int id: @xmlcharacters,
+ string text: string ref,
+ int parentid: @xmlparent ref,
+ int idx: int ref,
+ int isCDATA: int ref,
+ int fileid: @file ref
+);
+
+@xmlparent = @file | @xmlelement;
+@xmlnamespaceable = @xmlelement | @xmlattribute;
+
+xmllocations(
+ int xmlElement: @xmllocatable ref,
+ int location: @location_default ref
+);
+
+@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
+
+/*
+ * configuration files with key value pairs
+ */
+
+configs(
+ unique int id: @config
+);
+
+configNames(
+ unique int id: @configName,
+ int config: @config ref,
+ string name: string ref
+);
+
+configValues(
+ unique int id: @configValue,
+ int config: @config ref,
+ string value: string ref
+);
+
+configLocations(
+ int locatable: @configLocatable ref,
+ int location: @location_default ref
+);
+
+@configLocatable = @config | @configName | @configValue;
+
+ktComments(
+ unique int id: @ktcomment,
+ int kind: int ref,
+ string text : string ref
+)
+
+ktCommentSections(
+ unique int id: @ktcommentsection,
+ int comment: @ktcomment ref,
+ string content : string ref
+)
+
+ktCommentSectionNames(
+ unique int id: @ktcommentsection ref,
+ string name : string ref
+)
+
+ktCommentSectionSubjectNames(
+ unique int id: @ktcommentsection ref,
+ string subjectname : string ref
+)
+
+#keyset[id, owner]
+ktCommentOwners(
+ int id: @ktcomment ref,
+ int owner: @top ref
+)
+
+ktExtensionFunctions(
+ unique int id: @method ref,
+ int typeid: @type ref,
+ int kttypeid: @kt_type ref
+)
+
+ktProperties(
+ unique int id: @kt_property,
+ string nodeName: string ref
+)
+
+ktPropertyGetters(
+ unique int id: @kt_property ref,
+ int getter: @method ref
+)
+
+ktPropertySetters(
+ unique int id: @kt_property ref,
+ int setter: @method ref
+)
+
+ktPropertyBackingFields(
+ unique int id: @kt_property ref,
+ int backingField: @field ref
+)
+
+ktSyntheticBody(
+ unique int id: @callable ref,
+ int kind: int ref
+ // 1: ENUM_VALUES
+ // 2: ENUM_VALUEOF
+)
+
+ktLocalFunction(
+ unique int id: @method ref
+)
+
+ktInitializerAssignment(
+ unique int id: @assignexpr ref
+)
+
+ktPropertyDelegates(
+ unique int id: @kt_property ref,
+ unique int variableId: @variable ref
+)
+
+/**
+ * If `id` is a compiler generated element, then the kind indicates the
+ * reason that the compiler generated it.
+ * See `Element.compilerGeneratedReason()` for an explanation of what
+ * each `kind` means.
+ */
+compiler_generated(
+ unique int id: @element ref,
+ int kind: int ref
+)
+
+ktFunctionOriginalNames(
+ unique int id: @method ref,
+ string name: string ref
+)
+
+ktDataClasses(
+ unique int id: @class ref
+)
diff --git a/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/upgrade.properties b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/upgrade.properties
new file mode 100644
index 00000000000..0a7ee2789f5
--- /dev/null
+++ b/java/downgrades/709f1d1fd04ffd9bbcf242f17b120f8a389949bd/upgrade.properties
@@ -0,0 +1,4 @@
+description: Remove type parameters from modifiable entities
+compatibility: backwards
+hasModifier.rel: run hasModifier.qlo
+modifiers.rel: run modifiers.qlo
diff --git a/java/kotlin-extractor/build.py b/java/kotlin-extractor/build.py
index a4da1a2ea23..9525522869b 100755
--- a/java/kotlin-extractor/build.py
+++ b/java/kotlin-extractor/build.py
@@ -25,6 +25,8 @@ def parse_args():
dest='many', help='Build for a single version/kind')
parser.add_argument('--single-version',
help='Build for a specific version/kind')
+ parser.add_argument('--single-version-embeddable', action='store_true',
+ help='When building a single version, build an embeddable extractor (default is standalone)')
return parser.parse_args()
@@ -235,7 +237,13 @@ def compile_standalone(version):
if args.single_version:
- compile_standalone(args.single_version)
+ if args.single_version_embeddable == True:
+ compile_embeddable(args.single_version)
+ else:
+ compile_standalone(args.single_version)
+elif args.single_version_embeddable == True:
+ print("--single-version-embeddable requires --single-version", file=sys.stderr)
+ sys.exit(1)
elif args.many:
for version in kotlin_plugin_versions.many_versions:
compile_standalone(version)
diff --git a/java/kotlin-extractor/src/main/java/com/semmle/extractor/java/OdasaOutput.java b/java/kotlin-extractor/src/main/java/com/semmle/extractor/java/OdasaOutput.java
index a8cf0cb7b05..b7b11912325 100644
--- a/java/kotlin-extractor/src/main/java/com/semmle/extractor/java/OdasaOutput.java
+++ b/java/kotlin-extractor/src/main/java/com/semmle/extractor/java/OdasaOutput.java
@@ -4,11 +4,16 @@ import java.lang.reflect.*;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -29,6 +34,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes;
import com.semmle.util.concurrent.LockDirectory;
import com.semmle.util.concurrent.LockDirectory.LockingMode;
+import com.semmle.util.data.Pair;
import com.semmle.util.exception.CatastrophicError;
import com.semmle.util.exception.NestedError;
import com.semmle.util.exception.ResourceError;
@@ -43,6 +49,9 @@ import com.semmle.util.trap.dependencies.TrapSet;
import com.semmle.util.trap.pathtransformers.PathTransformer;
public class OdasaOutput {
+ // By default we use lockless TRAP writing, but this can be set
+ // if we want to use the old TRAP locking for any reason.
+ private final boolean use_trap_locking = Env.systemEnv().getBoolean("CODEQL_EXTRACTOR_JAVA_TRAP_LOCKING", false);
// either these are set ...
private final File trapFolder;
@@ -260,22 +269,59 @@ public class OdasaOutput {
* Any unique suffix needed to distinguish `sym` from other declarations with the same name.
* For functions for example, this means its parameter signature.
*/
- private TrapFileManager getMembersWriterForDecl(File trap, IrDeclaration sym, String signature) {
- TrapClassVersion currVersion = TrapClassVersion.fromSymbol(sym, log);
- String shortName = sym instanceof IrDeclarationWithName ? ((IrDeclarationWithName)sym).getName().asString() : "(name unknown)";
- if (trap.exists()) {
- // Only re-write an existing trap file if we encountered a newer version of the same class.
- TrapClassVersion trapVersion = readVersionInfo(trap);
- if (!currVersion.isValid()) {
- log.warn("Not rewriting trap file for: " + shortName + " " + trapVersion + " " + currVersion + " " + trap);
- } else if (currVersion.newerThan(trapVersion)) {
- log.trace("Rewriting trap file for: " + shortName + " " + trapVersion + " " + currVersion + " " + trap);
- deleteTrapFileAndDependencies(sym, signature);
+ private TrapFileManager getMembersWriterForDecl(File trap, File trapFileBase, TrapClassVersion trapFileVersion, IrDeclaration sym, String signature) {
+ if (use_trap_locking) {
+ TrapClassVersion currVersion = TrapClassVersion.fromSymbol(sym, log);
+ String shortName = sym instanceof IrDeclarationWithName ? ((IrDeclarationWithName)sym).getName().asString() : "(name unknown)";
+ if (trap.exists()) {
+ // Only re-write an existing trap file if we encountered a newer version of the same class.
+ TrapClassVersion trapVersion = readVersionInfo(trap);
+ if (!currVersion.isValid()) {
+ log.warn("Not rewriting trap file for: " + shortName + " " + trapVersion + " " + currVersion + " " + trap);
+ } else if (currVersion.newerThan(trapVersion)) {
+ log.trace("Rewriting trap file for: " + shortName + " " + trapVersion + " " + currVersion + " " + trap);
+ deleteTrapFileAndDependencies(sym, signature);
+ } else {
+ return null;
+ }
} else {
- return null;
+ log.trace("Writing trap file for: " + shortName + " " + currVersion + " " + trap);
}
} else {
- log.trace("Writing trap file for: " + shortName + " " + currVersion + " " + trap);
+ // If the TRAP file already exists then we
+ // don't need to write it.
+ if (trap.exists()) {
+ log.warn("Not rewriting trap file for " + trap.toString() + " as it exists");
+ return null;
+ }
+ // If the TRAP file was written in the past, and
+ // then renamed to its trap-old name, then we
+ // don't need to rewrite it only to rename it
+ // again.
+ File trapFileDir = trap.getParentFile();
+ File trapOld = new File(trapFileDir, trap.getName().replace(".trap.gz", ".trap-old.gz"));
+ if (trapOld.exists()) {
+ log.warn("Not rewriting trap file for " + trap.toString() + " as the trap-old exists");
+ return null;
+ }
+ // Otherwise, if any newer TRAP file has already
+ // been written then we don't need to write
+ // anything.
+ if (trapFileBase != null && trapFileVersion != null && trapFileDir.exists()) {
+ String trapFileBaseName = trapFileBase.getName();
+
+ for (File f: FileUtil.list(trapFileDir)) {
+ String name = f.getName();
+ Matcher m = selectClassVersionComponents.matcher(name);
+ if (m.matches() && m.group(1).equals(trapFileBaseName)) {
+ TrapClassVersion v = new TrapClassVersion(Integer.valueOf(m.group(2)), Integer.valueOf(m.group(3)), Long.valueOf(m.group(4)), m.group(5));
+ if (v.newerThan(trapFileVersion)) {
+ log.warn("Not rewriting trap file for " + trap.toString() + " as " + f.toString() + " exists");
+ return null;
+ }
+ }
+ }
+ }
}
return trapWriter(trap, sym, signature);
}
@@ -328,19 +374,24 @@ public class OdasaOutput {
}
writeTrapDependencies(trapDependenciesForClass);
- // Record major/minor version information for extracted class files.
- // This is subsequently used to determine whether to re-extract (a newer version of) the same class.
- File metadataFile = new File(trapFile.getAbsolutePath().replace(".trap.gz", ".metadata"));
- try {
- Map versionMap = new LinkedHashMap<>();
- TrapClassVersion tcv = TrapClassVersion.fromSymbol(sym, log);
- versionMap.put(MAJOR_VERSION, String.valueOf(tcv.getMajorVersion()));
- versionMap.put(MINOR_VERSION, String.valueOf(tcv.getMinorVersion()));
- versionMap.put(LAST_MODIFIED, String.valueOf(tcv.getLastModified()));
- versionMap.put(EXTRACTOR_NAME, tcv.getExtractorName());
- FileUtil.writePropertiesCSV(metadataFile, versionMap);
- } catch (IOException e) {
- log.warn("Could not save trap metadata file: " + metadataFile.getAbsolutePath(), e);
+
+ // If we are using TRAP locking then we
+ // need to write a metadata file.
+ if (use_trap_locking) {
+ // Record major/minor version information for extracted class files.
+ // This is subsequently used to determine whether to re-extract (a newer version of) the same class.
+ File metadataFile = new File(trapFile.getAbsolutePath().replace(".trap.gz", ".metadata"));
+ try {
+ Map versionMap = new LinkedHashMap<>();
+ TrapClassVersion tcv = TrapClassVersion.fromSymbol(sym, log);
+ versionMap.put(MAJOR_VERSION, String.valueOf(tcv.getMajorVersion()));
+ versionMap.put(MINOR_VERSION, String.valueOf(tcv.getMinorVersion()));
+ versionMap.put(LAST_MODIFIED, String.valueOf(tcv.getLastModified()));
+ versionMap.put(EXTRACTOR_NAME, tcv.getExtractorName());
+ FileUtil.writePropertiesCSV(metadataFile, versionMap);
+ } catch (IOException e) {
+ log.warn("Could not save trap metadata file: " + metadataFile.getAbsolutePath(), e);
+ }
}
}
private void writeTrapDependencies(TrapDependencies trapDependencies) {
@@ -358,6 +409,8 @@ public class OdasaOutput {
* Trap file locking.
*/
+ private final Pattern selectClassVersionComponents = Pattern.compile("(.*)#(-?[0-9]+)\\.(-?[0-9]+)-(-?[0-9]+)-(.*)\\.trap\\.gz");
+
/**
* CAUTION: to avoid the potential for deadlock between multiple concurrent extractor processes,
* only one source file {@link TrapLocker} may be open at any time, and the lock must be obtained
@@ -414,6 +467,10 @@ public class OdasaOutput {
public class TrapLocker implements AutoCloseable {
private final IrDeclaration sym;
private final File trapFile;
+ // trapFileBase is used when doing lockless TRAP file writing.
+ // It is trapFile without the #metadata.trap.gz suffix.
+ private File trapFileBase = null;
+ private TrapClassVersion trapFileVersion = null;
private final String signature;
private TrapLocker(IrDeclaration decl, String signature) {
this.sym = decl;
@@ -422,7 +479,20 @@ public class OdasaOutput {
log.error("Null symbol passed for Kotlin TRAP locker");
trapFile = null;
} else {
- trapFile = getTrapFileForDecl(sym, signature);
+ File normalTrapFile = getTrapFileForDecl(sym, signature);
+ if (use_trap_locking) {
+ trapFile = normalTrapFile;
+ } else {
+ // We encode the metadata into the filename, so that the
+ // TRAP filenames for different metadatas don't overlap.
+ trapFileVersion = TrapClassVersion.fromSymbol(sym, log);
+ String baseName = normalTrapFile.getName().replace(".trap.gz", "");
+ // If a class has lots of inner classes, then we get lots of files
+ // in a single directory. This makes our directory listings later slow.
+ // To avoid this, rather than using files named .../Foo*, we use .../Foo/Foo*.
+ trapFileBase = new File(new File(normalTrapFile.getParentFile(), baseName), baseName);
+ trapFile = new File(trapFileBase.getPath() + '#' + trapFileVersion.toString() + ".trap.gz");
+ }
}
}
private TrapLocker(File jarFile) {
@@ -437,20 +507,83 @@ public class OdasaOutput {
}
public TrapFileManager getTrapFileManager() {
if (trapFile!=null) {
- lockTrapFile(trapFile);
- return getMembersWriterForDecl(trapFile, sym, signature);
+ if (use_trap_locking) {
+ lockTrapFile(trapFile);
+ }
+ return getMembersWriterForDecl(trapFile, trapFileBase, trapFileVersion, sym, signature);
} else {
return null;
}
}
+
@Override
public void close() {
if (trapFile!=null) {
try {
- unlockTrapFile(trapFile);
+ if (use_trap_locking) {
+ unlockTrapFile(trapFile);
+ }
} catch (NestedError e) {
log.warn("Error unlocking trap file " + trapFile.getAbsolutePath(), e);
}
+
+ // If we are writing TRAP file locklessly, then now that we
+ // have finished writing our TRAP file, we want to rename
+ // and TRAP file that matches our trapFileBase but doesn't
+ // have the latest metadata.
+ // Renaming it to trap-old means that it won't be imported,
+ // but we can still use its presence to avoid future
+ // invocations rewriting it, and it means that the information
+ // is in the TRAP directory if we need it for debugging.
+ if (!use_trap_locking && sym != null) {
+ File trapFileDir = trapFileBase.getParentFile();
+ String trapFileBaseName = trapFileBase.getName();
+
+ List> pairs = new LinkedList>();
+ for (File f: FileUtil.list(trapFileDir)) {
+ String name = f.getName();
+ Matcher m = selectClassVersionComponents.matcher(name);
+ if (m.matches()) {
+ if (m.group(1).equals(trapFileBaseName)) {
+ TrapClassVersion v = new TrapClassVersion(Integer.valueOf(m.group(2)), Integer.valueOf(m.group(3)), Long.valueOf(m.group(4)), m.group(5));
+ pairs.add(new Pair(f, v));
+ } else {
+ // Everything in this directory should be for the same TRAP file base
+ log.error("Unexpected sibling " + m.group(1) + " when extracting " + trapFileBaseName);
+ }
+ }
+ }
+ if (pairs.isEmpty()) {
+ log.error("Wrote TRAP file, but no TRAP files exist for " + trapFile.getAbsolutePath());
+ } else {
+ Comparator> comparator = new Comparator>() {
+ @Override
+ public int compare(Pair p1, Pair p2) {
+ TrapClassVersion v1 = p1.snd();
+ TrapClassVersion v2 = p2.snd();
+ if (v1.equals(v2)) {
+ return 0;
+ } else if (v1.newerThan(v2)) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ };
+ TrapClassVersion latestVersion = Collections.max(pairs, comparator).snd();
+
+ for (Pair p: pairs) {
+ if (!latestVersion.equals(p.snd())) {
+ File f = p.fst();
+ File fOld = new File(f.getParentFile(), f.getName().replace(".trap.gz", ".trap-old.gz"));
+ // We aren't interested in whether or not this succeeds;
+ // it may fail because a concurrent extractor has already
+ // renamed it.
+ f.renameTo(fOld);
+ }
+ }
+ }
+ }
}
}
@@ -505,13 +638,24 @@ public class OdasaOutput {
this.lastModified = lastModified;
this.extractorName = extractorName;
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof TrapClassVersion) {
+ TrapClassVersion other = (TrapClassVersion)obj;
+ return majorVersion == other.majorVersion && minorVersion == other.minorVersion && lastModified == other.lastModified && extractorName.equals(other.extractorName);
+ } else {
+ return false;
+ }
+ }
+
private boolean newerThan(TrapClassVersion tcv) {
// Classes being compiled from source have major version 0 but should take precedence
// over any classes with the same qualified name loaded from the classpath
// in previous or subsequent extractor invocations.
- if (tcv.majorVersion==0)
+ if (tcv.majorVersion == 0 && majorVersion != 0)
return false;
- else if (majorVersion==0)
+ else if (majorVersion == 0 && tcv.majorVersion != 0)
return true;
// Always consider the Kotlin extractor superior to the Java extractor, because we may decode and extract
// Kotlin metadata that the Java extractor can't understand:
diff --git a/java/kotlin-extractor/src/main/java/com/semmle/util/expansion/ExpansionEnvironment.java b/java/kotlin-extractor/src/main/java/com/semmle/util/expansion/ExpansionEnvironment.java
index a8008ca6299..47bbb1d2029 100644
--- a/java/kotlin-extractor/src/main/java/com/semmle/util/expansion/ExpansionEnvironment.java
+++ b/java/kotlin-extractor/src/main/java/com/semmle/util/expansion/ExpansionEnvironment.java
@@ -123,7 +123,7 @@ public class ExpansionEnvironment {
}
/**
- * This the old default constructor, which always enables command substutitions.
+ * This the old default constructor, which always enables command substitutions.
* Doing so is a security risk whenever the string you expand may come
* from an untrusted source, so you should only do that when you explicitly want
* to do it and have decided that it is safe. (And then use the constructor that
diff --git a/java/kotlin-extractor/src/main/java/com/semmle/util/files/FileUtil.java b/java/kotlin-extractor/src/main/java/com/semmle/util/files/FileUtil.java
index 6c3e754310e..81a9f46a71f 100644
--- a/java/kotlin-extractor/src/main/java/com/semmle/util/files/FileUtil.java
+++ b/java/kotlin-extractor/src/main/java/com/semmle/util/files/FileUtil.java
@@ -1033,11 +1033,11 @@ public class FileUtil
}
/**
- * Santize path string To handle windows drive letters and cross-platform builds.
+ * Sanitize path string To handle windows drive letters and cross-platform builds.
* @param pathString to be sanitized
* @return sanitized path string
*/
- private static String santizePathString(String pathString) {
+ private static String sanitizePathString(String pathString) {
// Replace ':' by '_', as the extractor does - to handle Windows drive letters
pathString = pathString.replace(':', '_');
@@ -1059,7 +1059,7 @@ public class FileUtil
*/
public static File appendAbsolutePath (File root, String absolutePath)
{
- absolutePath = santizePathString(absolutePath);
+ absolutePath = sanitizePathString(absolutePath);
return new File(root, absolutePath).getAbsoluteFile();
}
@@ -1075,7 +1075,7 @@ public class FileUtil
*/
public static Path appendAbsolutePath(Path root, String absolutePathString){
- absolutePathString = santizePathString(absolutePathString);
+ absolutePathString = sanitizePathString(absolutePathString);
Path path = Paths.get(absolutePathString);
diff --git a/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt b/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt
index b1b2823b6b5..9a99b05f775 100644
--- a/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt
+++ b/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt
@@ -84,7 +84,7 @@ class ExternalDeclExtractor(val logger: FileLogger, val invocationTrapFile: Stri
// file information if needed:
val ftw = tw.makeFileTrapWriter(binaryPath, irDecl is IrClass)
- val fileExtractor = KotlinFileExtractor(logger, ftw, binaryPath, manager, this, primitiveTypeMapping, pluginContext, globalExtensionState)
+ val fileExtractor = KotlinFileExtractor(logger, ftw, null, binaryPath, manager, this, primitiveTypeMapping, pluginContext, KotlinFileExtractor.DeclarationStack(), globalExtensionState)
if (irDecl is IrClass) {
// Populate a location and compilation-unit package for the file. This is similar to
diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt b/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt
index 3b58400eca5..a31bfee0b4f 100644
--- a/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt
+++ b/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt
@@ -74,7 +74,7 @@ class KotlinExtractorExtension(
// First, if we can find our log directory, then let's try
// making a log file there:
val extractorLogDir = System.getenv("CODEQL_EXTRACTOR_JAVA_LOG_DIR")
- if (extractorLogDir != null || extractorLogDir != "") {
+ if (extractorLogDir != null && extractorLogDir != "") {
// We use a slightly different filename pattern compared
// to normal logs. Just the existence of a `-top` log is
// a sign that something's gone very wrong.
@@ -296,7 +296,9 @@ private fun doFile(
context.clear()
}
- val dbSrcFilePath = Paths.get("$dbSrcDir/$srcFilePath")
+ val srcFileRelativePath = srcFilePath.replace(':', '_')
+
+ val dbSrcFilePath = Paths.get("$dbSrcDir/$srcFileRelativePath")
val dbSrcDirPath = dbSrcFilePath.parent
Files.createDirectories(dbSrcDirPath)
val srcTmpFile = File.createTempFile(dbSrcFilePath.fileName.toString() + ".", ".src.tmp", dbSrcDirPath.toFile())
@@ -305,7 +307,7 @@ private fun doFile(
}
srcTmpFile.renameTo(dbSrcFilePath.toFile())
- val trapFileName = "$dbTrapDir/$srcFilePath.trap"
+ val trapFileName = "$dbTrapDir/$srcFileRelativePath.trap"
val trapFileWriter = getTrapFileWriter(compression, logger, trapFileName)
if (checkTrapIdentical || !trapFileWriter.exists()) {
@@ -322,7 +324,8 @@ private fun doFile(
// file information
val sftw = tw.makeSourceFileTrapWriter(srcFile, true)
val externalDeclExtractor = ExternalDeclExtractor(logger, invocationTrapFile, srcFilePath, primitiveTypeMapping, pluginContext, globalExtensionState, fileTrapWriter)
- val fileExtractor = KotlinFileExtractor(logger, sftw, srcFilePath, null, externalDeclExtractor, primitiveTypeMapping, pluginContext, globalExtensionState)
+ val linesOfCode = LinesOfCode(logger, sftw, srcFile)
+ val fileExtractor = KotlinFileExtractor(logger, sftw, linesOfCode, srcFilePath, null, externalDeclExtractor, primitiveTypeMapping, pluginContext, KotlinFileExtractor.DeclarationStack(), globalExtensionState)
fileExtractor.extractFileContents(srcFile, sftw.fileId)
externalDeclExtractor.extractExternalClasses()
@@ -397,7 +400,7 @@ private abstract class TrapFileWriter(val logger: FileLogger, trapName: String,
fun getTempWriter(): BufferedWriter {
if (this::tempFile.isInitialized) {
- logger.error("Temp writer reinitiailised for $realFile")
+ logger.error("Temp writer reinitialized for $realFile")
}
tempFile = File.createTempFile(realFile.getName() + ".", ".trap.tmp" + extension, parentDir)
return getWriter(tempFile)
diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt
index f023368d3e0..5741aab36d1 100644
--- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt
+++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.backend.js.utils.realOverrideTarget
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
+import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
@@ -30,16 +31,19 @@ import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.util.OperatorNameConventions
import java.io.Closeable
import java.util.*
+import kotlin.collections.ArrayList
open class KotlinFileExtractor(
override val logger: FileLogger,
override val tw: FileTrapWriter,
+ val linesOfCode: LinesOfCode?,
val filePath: String,
dependencyCollector: OdasaOutput.TrapFileManager?,
externalClassExtractor: ExternalDeclExtractor,
primitiveTypeMapping: PrimitiveTypeMapping,
pluginContext: IrPluginContext,
- globalExtensionState: KotlinExtractorGlobalState
+ val declarationStack: DeclarationStack,
+ globalExtensionState: KotlinExtractorGlobalState,
): KotlinUsesExtractor(logger, tw, dependencyCollector, externalClassExtractor, primitiveTypeMapping, pluginContext, globalExtensionState) {
private inline fun with(kind: String, element: IrElement, f: () -> T): T {
@@ -88,6 +92,8 @@ open class KotlinFileExtractor(
if (!declarationStack.isEmpty()) {
logger.errorElement("Declaration stack is not empty after processing the file", file)
}
+
+ linesOfCode?.linesOfCodeInFile(id)
}
}
@@ -114,11 +120,7 @@ open class KotlinFileExtractor(
}
private fun shouldExtractDecl(declaration: IrDeclaration, extractPrivateMembers: Boolean) =
- extractPrivateMembers ||
- when(declaration) {
- is IrDeclarationWithVisibility -> declaration.visibility.let { it != DescriptorVisibilities.PRIVATE && it != DescriptorVisibilities.PRIVATE_TO_THIS }
- else -> true
- }
+ extractPrivateMembers || !isPrivate(declaration)
fun extractDeclaration(declaration: IrDeclaration, extractPrivateMembers: Boolean, extractFunctionBodies: Boolean) {
with("declaration", declaration) {
@@ -152,7 +154,7 @@ open class KotlinFileExtractor(
is IrEnumEntry -> {
val parentId = useDeclarationParent(declaration.parent, false)?.cast()
if (parentId != null) {
- extractEnumEntry(declaration, parentId, extractFunctionBodies)
+ extractEnumEntry(declaration, parentId, extractPrivateMembers, extractFunctionBodies)
}
Unit
}
@@ -200,6 +202,16 @@ open class KotlinFileExtractor(
}
}
+ if (tp.isReified) {
+ addModifiers(id, "reified")
+ }
+
+ if (tp.variance == Variance.IN_VARIANCE) {
+ addModifiers(id, "in")
+ } else if (tp.variance == Variance.OUT_VARIANCE) {
+ addModifiers(id, "out")
+ }
+
return id
}
}
@@ -228,7 +240,7 @@ open class KotlinFileExtractor(
// default java visibility (top level)
}
JavaVisibilities.ProtectedAndPackage -> {
- // default java visibility (member level)
+ addModifiers(id, "protected")
}
else -> logger.errorElement("Unexpected delegated visibility: $v", elementForLocation)
}
@@ -251,9 +263,23 @@ open class KotlinFileExtractor(
}
}
+ fun extractClassInstance(classLabel: Label, c: IrClass, argsIncludingOuterClasses: List?, shouldExtractOutline: Boolean, shouldExtractDetails: Boolean) {
+ DeclarationStackAdjuster(c).use {
+ if (shouldExtractOutline) {
+ extractClassWithoutMembers(c, argsIncludingOuterClasses)
+ }
+
+ if (shouldExtractDetails) {
+ val supertypeMode = if (argsIncludingOuterClasses == null) ExtractSupertypesMode.Raw else ExtractSupertypesMode.Specialised(argsIncludingOuterClasses)
+ extractClassSupertypes(c, classLabel, supertypeMode, true)
+ extractNonPrivateMemberPrototypes(c, argsIncludingOuterClasses, classLabel)
+ }
+ }
+ }
+
// `argsIncludingOuterClasses` can be null to describe a raw generic type.
// For non-generic types it will be zero-length list.
- fun extractClassInstance(c: IrClass, argsIncludingOuterClasses: List?): Label {
+ private fun extractClassWithoutMembers(c: IrClass, argsIncludingOuterClasses: List?): Label {
with("class instance", c) {
if (argsIncludingOuterClasses?.isEmpty() == true) {
logger.error("Instance without type arguments: " + c.name.asString())
@@ -264,10 +290,9 @@ open class KotlinFileExtractor(
val pkg = c.packageFqName?.asString() ?: ""
val cls = classLabelResults.shortName
val pkgId = extractPackage(pkg)
- val kind = c.kind
// TODO: There's lots of duplication between this and extractClassSource.
// Can we share it?
- if(kind == ClassKind.INTERFACE || kind == ClassKind.ANNOTATION_CLASS) {
+ if (c.isInterfaceLike) {
val interfaceId = id.cast()
val sourceInterfaceId = useClassSource(c).cast()
tw.writeInterfaces(interfaceId, cls, pkgId, sourceInterfaceId)
@@ -276,6 +301,7 @@ open class KotlinFileExtractor(
val sourceClassId = useClassSource(c).cast()
tw.writeClasses(classId, cls, pkgId, sourceClassId)
+ val kind = c.kind
if (kind == ClassKind.ENUM_CLASS) {
tw.writeIsEnumType(classId)
} else if (kind != ClassKind.CLASS && kind != ClassKind.OBJECT) {
@@ -337,23 +363,37 @@ open class KotlinFileExtractor(
}
}
+ private fun makeTypeParamSubstitution(c: IrClass, argsIncludingOuterClasses: List?) =
+ when (argsIncludingOuterClasses) {
+ null -> { x: IrType, _: TypeContext, _: IrPluginContext -> x.toRawType() }
+ else -> makeGenericSubstitutionFunction(c, argsIncludingOuterClasses)
+ }
+
+ fun extractDeclarationPrototype(d: IrDeclaration, parentId: Label, argsIncludingOuterClasses: List?, typeParamSubstitutionQ: TypeSubstitution? = null) {
+ val typeParamSubstitution = typeParamSubstitutionQ ?:
+ when(val parent = d.parent) {
+ is IrClass -> makeTypeParamSubstitution(parent, argsIncludingOuterClasses)
+ else -> {
+ logger.warnElement("Unable to extract prototype of local declaration", d)
+ return
+ }
+ }
+ when (d) {
+ is IrFunction -> extractFunction(d, parentId, extractBody = false, extractMethodAndParameterTypeAccesses = false, typeParamSubstitution, argsIncludingOuterClasses)
+ is IrProperty -> extractProperty(d, parentId, extractBackingField = false, extractFunctionBodies = false, extractPrivateMembers = false, typeParamSubstitution, argsIncludingOuterClasses)
+ else -> {}
+ }
+ }
+
// `argsIncludingOuterClasses` can be null to describe a raw generic type.
// For non-generic types it will be zero-length list.
- fun extractNonPrivateMemberPrototypes(c: IrClass, argsIncludingOuterClasses: List?, id: Label) {
+ private fun extractNonPrivateMemberPrototypes(c: IrClass, argsIncludingOuterClasses: List?, id: Label) {
with("member prototypes", c) {
- val typeParamSubstitution =
- when (argsIncludingOuterClasses) {
- null -> { x: IrType, _: TypeContext, _: IrPluginContext -> x.toRawType() }
- else -> makeGenericSubstitutionFunction(c, argsIncludingOuterClasses)
- }
+ val typeParamSubstitution = makeTypeParamSubstitution(c, argsIncludingOuterClasses)
c.declarations.map {
if (shouldExtractDecl(it, false)) {
- when(it) {
- is IrFunction -> extractFunction(it, id, extractBody = false, extractMethodAndParameterTypeAccesses = false, typeParamSubstitution, argsIncludingOuterClasses)
- is IrProperty -> extractProperty(it, id, extractBackingField = false, extractFunctionBodies = false, extractPrivateMembers = false, typeParamSubstitution, argsIncludingOuterClasses)
- else -> {}
- }
+ extractDeclarationPrototype(it, id, argsIncludingOuterClasses, typeParamSubstitution)
}
}
}
@@ -386,9 +426,7 @@ open class KotlinFileExtractor(
addModifiers(obinitId, "private")
// add body:
- val blockId = tw.getFreshIdLabel()
- tw.writeStmts_block(blockId, obinitId, 0, obinitId)
- tw.writeHasLocation(blockId, locId)
+ val blockId = extractBlockBody(obinitId, locId)
extractDeclInitializers(c.declarations, false) { Pair(blockId, obinitId) }
}
@@ -403,14 +441,14 @@ open class KotlinFileExtractor(
val pkg = c.packageFqName?.asString() ?: ""
val cls = if (c.isAnonymousObject) "" else c.name.asString()
val pkgId = extractPackage(pkg)
- val kind = c.kind
- if (kind == ClassKind.INTERFACE || kind == ClassKind.ANNOTATION_CLASS) {
+ if (c.isInterfaceLike) {
val interfaceId = id.cast()
tw.writeInterfaces(interfaceId, cls, pkgId, interfaceId)
} else {
val classId = id.cast()
tw.writeClasses(classId, cls, pkgId, classId)
+ val kind = c.kind
if (kind == ClassKind.ENUM_CLASS) {
tw.writeIsEnumType(classId)
} else if (kind != ClassKind.CLASS && kind != ClassKind.OBJECT) {
@@ -457,6 +495,8 @@ open class KotlinFileExtractor(
extractClassModifiers(c, id)
extractClassSupertypes(c, id, inReceiverContext = true) // inReceiverContext = true is specified to force extraction of member prototypes of base types
+ linesOfCode?.linesOfCodeInDeclaration(c, id)
+
return id
}
}
@@ -475,7 +515,7 @@ open class KotlinFileExtractor(
val proxyFunctionId = tw.getLabelFor(getFunctionLabel(f, classId, listOf()))
// We extract the function prototype with its ID overridden to belong to `c` not the companion object,
// but suppress outputting the body, which we will replace with a delegating call below.
- forceExtractFunction(f, classId, extractBody = false, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution = null, classTypeArgsIncludingOuterClasses = listOf(), idOverride = proxyFunctionId, locOverride = null, extractOrigin = false)
+ forceExtractFunction(f, classId, extractBody = false, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution = null, classTypeArgsIncludingOuterClasses = listOf(), extractOrigin = false, OverriddenFunctionAttributes(id = proxyFunctionId))
addModifiers(proxyFunctionId, "static")
tw.writeCompiler_generated(proxyFunctionId, CompilerGeneratedKinds.JVMSTATIC_PROXY_METHOD.kind)
if (extractFunctionBodies) {
@@ -514,8 +554,12 @@ open class KotlinFileExtractor(
val wholeDeclAnnotated = it.hasAnnotation(jvmStaticFqName)
when(it) {
is IrFunction -> {
- if (wholeDeclAnnotated)
+ if (wholeDeclAnnotated) {
makeProxyFunction(it)
+ if (it.hasAnnotation(jvmOverloadsFqName)) {
+ extractGeneratedOverloads(it, classId, classId, extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution = null, classTypeArgsIncludingOuterClasses = listOf())
+ }
+ }
}
is IrProperty -> {
it.getter?.let { getter ->
@@ -549,12 +593,7 @@ open class KotlinFileExtractor(
var parent: IrDeclarationParent? = declarationParent
while (parent != null) {
if (parent is IrClass) {
- val parentId =
- if (parent.isAnonymousObject) {
- useAnonymousClass(parent).javaResult.id.cast()
- } else {
- useClassInstance(parent, parentClassTypeArguments).typeResult.id
- }
+ val parentId = useClassInstance(parent, parentClassTypeArguments).typeResult.id
tw.writeEnclInReftype(innerId, parentId)
if (innerClass != null && innerClass.isCompanion) {
// If we are a companion then our parent has a
@@ -643,11 +682,11 @@ open class KotlinFileExtractor(
extractTypeAccessRecursive(substitutedType, location, id, -1)
}
val syntheticParameterNames = isUnderscoreParameter(vp) || ((vp.parent as? IrFunction)?.let { hasSynthesizedParameterNames(it) } ?: true)
- return extractValueParameter(id, substitutedType, vp.name.asString(), location, parent, idx, useValueParameter(vp, parentSourceDeclaration), vp.isVararg, syntheticParameterNames)
+ return extractValueParameter(id, substitutedType, vp.name.asString(), location, parent, idx, useValueParameter(vp, parentSourceDeclaration), syntheticParameterNames, vp.isVararg, vp.isNoinline, vp.isCrossinline)
}
}
- private fun extractValueParameter(id: Label, t: IrType, name: String, locId: Label, parent: Label, idx: Int, paramSourceDeclaration: Label, isVararg: Boolean, syntheticParameterNames: Boolean): TypeResults {
+ private fun extractValueParameter(id: Label, t: IrType, name: String, locId: Label, parent: Label, idx: Int, paramSourceDeclaration: Label, syntheticParameterNames: Boolean, isVararg: Boolean, isNoinline: Boolean, isCrossinline: Boolean): TypeResults {
val type = useType(t)
tw.writeParams(id, type.javaResult.id, idx, parent, paramSourceDeclaration)
tw.writeParamsKotlinType(id, type.kotlinResult.id)
@@ -658,6 +697,12 @@ open class KotlinFileExtractor(
if (isVararg) {
tw.writeIsVarargsParam(id)
}
+ if (isNoinline) {
+ addModifiers(id, "noinline")
+ }
+ if (isCrossinline) {
+ addModifiers(id, "crossinline")
+ }
return type
}
@@ -676,7 +721,7 @@ open class KotlinFileExtractor(
"",
listOf(),
pluginContext.irBuiltIns.unitType,
- extensionReceiverParameter = null,
+ extensionParamType = null,
functionTypeParameters = listOf(),
classTypeArgsIncludingOuterClasses = listOf(),
overridesCollectionsMethod = false,
@@ -693,11 +738,10 @@ open class KotlinFileExtractor(
val locId = tw.getWholeFileLocation()
tw.writeHasLocation(clinitId, locId)
+ addModifiers(clinitId, "static")
+
// add and return body block:
- Pair(tw.getFreshIdLabel().also({
- tw.writeStmts_block(it, clinitId, 0, clinitId)
- tw.writeHasLocation(it, locId)
- }), clinitId)
+ Pair(extractBlockBody(clinitId, locId), clinitId)
}
}
}
@@ -762,32 +806,18 @@ open class KotlinFileExtractor(
val expr = initializer.expression
val declLocId = tw.getLocation(f)
- val stmtId = tw.getFreshIdLabel()
- tw.writeStmts_exprstmt(stmtId, blockAndFunctionId.first, idx++, blockAndFunctionId.second)
- tw.writeHasLocation(stmtId, declLocId)
- val assignmentId = tw.getFreshIdLabel()
- val type = useType(if (isAnnotationClassField) kClassToJavaClass(expr.type) else expr.type)
- tw.writeExprs_assignexpr(assignmentId, type.javaResult.id, stmtId, 0)
- tw.writeExprsKotlinType(assignmentId, type.kotlinResult.id)
- tw.writeHasLocation(assignmentId, declLocId)
- tw.writeCallableEnclosingExpr(assignmentId, blockAndFunctionId.second)
- tw.writeStatementEnclosingExpr(assignmentId, stmtId)
- tw.writeKtInitializerAssignment(assignmentId)
-
- val lhsId = tw.getFreshIdLabel()
- tw.writeExprs_varaccess(lhsId, lhsType.javaResult.id, assignmentId, 0)
- tw.writeExprsKotlinType(lhsId, lhsType.kotlinResult.id)
- tw.writeHasLocation(lhsId, declLocId)
- tw.writeCallableEnclosingExpr(lhsId, blockAndFunctionId.second)
- tw.writeStatementEnclosingExpr(lhsId, stmtId)
-
- tw.writeVariableBinding(lhsId, vId)
-
- if (static) {
- extractStaticTypeAccessQualifier(f, lhsId, declLocId, blockAndFunctionId.second, stmtId)
+ extractExpressionStmt(declLocId, blockAndFunctionId.first, idx++, blockAndFunctionId.second).also { stmtId ->
+ val type = if (isAnnotationClassField) kClassToJavaClass(expr.type) else expr.type
+ extractAssignExpr(type, declLocId, stmtId, 0, blockAndFunctionId.second, stmtId).also { assignmentId ->
+ tw.writeKtInitializerAssignment(assignmentId)
+ extractVariableAccess(vId, lhsType, declLocId, assignmentId, 0, blockAndFunctionId.second, stmtId).also { lhsId ->
+ if (static) {
+ extractStaticTypeAccessQualifier(f, lhsId, declLocId, blockAndFunctionId.second, stmtId)
+ }
+ }
+ extractExpressionExpr(expr, blockAndFunctionId.second, assignmentId, 1, stmtId)
+ }
}
-
- extractExpressionExpr(expr, blockAndFunctionId.second, assignmentId, 1, stmtId)
}
for (decl in declarations) {
@@ -818,87 +848,310 @@ open class KotlinFileExtractor(
private fun extractFunction(f: IrFunction, parentId: Label, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?) =
if (isFake(f))
null
- else
- forceExtractFunction(f, parentId, extractBody, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, null, null)
+ else {
+ forceExtractFunction(f, parentId, extractBody, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses).also {
+ // The defaults-forwarder function is a static utility, not a member, so we only need to extract this for the unspecialised instance of this class.
+ if (classTypeArgsIncludingOuterClasses.isNullOrEmpty())
+ extractDefaultsFunction(f, parentId, extractBody, extractMethodAndParameterTypeAccesses)
+ extractGeneratedOverloads(f, parentId, null, extractBody, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses)
+ }
+ }
- private fun forceExtractFunction(f: IrFunction, parentId: Label, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?, idOverride: Label?, locOverride: Label?, extractOrigin: Boolean = true): Label {
+ private fun extractDefaultsFunction(f: IrFunction, parentId: Label, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean) {
+ if (f.valueParameters.none { it.defaultValue != null })
+ return
+
+ val id = getDefaultsMethodLabel(f)
+ val locId = getLocation(f, null)
+ val extReceiver = f.extensionReceiverParameter
+ val dispatchReceiver = if (f.shouldExtractAsStatic) null else f.dispatchReceiverParameter
+ val parameterTypes = listOfNotNull(extReceiver?.let { erase(it.type) }) + getDefaultsMethodArgTypes(f)
+ val allParamTypeResults = parameterTypes.mapIndexed { i, paramType ->
+ val paramId = tw.getLabelFor(getValueParameterLabel(id, i))
+ extractValueParameter(paramId, paramType, "p$i", locId, id, i, paramId, isVararg = false, syntheticParameterNames = true, isCrossinline = false, isNoinline = false).also {
+ if (extractMethodAndParameterTypeAccesses)
+ extractTypeAccess(useType(paramType), locId, paramId, -1)
+ }
+ }
+ val paramsSignature = allParamTypeResults.joinToString(separator = ",", prefix = "(", postfix = ")") { signatureOrWarn(it.javaResult, f) }
+ val shortName = getDefaultsMethodName(f)
+
+ if (f.symbol is IrConstructorSymbol) {
+ val constrId = id.cast()
+ extractConstructor(constrId, shortName, paramsSignature, parentId, constrId)
+ } else {
+ val methodId = id.cast()
+ extractMethod(methodId, locId, shortName, erase(f.returnType), paramsSignature, parentId, methodId, origin = null, extractTypeAccess = extractMethodAndParameterTypeAccesses)
+ addModifiers(id, "static")
+ }
+ tw.writeHasLocation(id, locId)
+ if (f.visibility != DescriptorVisibilities.PRIVATE && f.visibility != DescriptorVisibilities.PRIVATE_TO_THIS) {
+ // Private methods have package-private (default) visibility $default methods; all other visibilities seem to produce a public $default method.
+ addModifiers(id, "public")
+ }
+ tw.writeCompiler_generated(id, CompilerGeneratedKinds.DEFAULT_ARGUMENTS_METHOD.kind)
+
+ if (extractBody) {
+ val nonSyntheticParams = listOfNotNull(dispatchReceiver) + f.valueParameters
+ // This stack entry represents as if we're extracting the 'real' function `f`, giving the indices of its non-synthetic parameters
+ // such that when we extract the default expressions below, any reference to f's nth parameter will resolve to f$default's
+ // n + o'th parameter, where `o` is the parameter offset caused by adding any dispatch receiver to the parameter list.
+ // Note we don't need to add the extension receiver here because `useValueParameter` always assumes an extension receiver
+ // will be prepended if one exists.
+ // Note we have to get the real function ID here before entering this block, because otherwise we'll misrepresent the signature of a generic
+ // function without its type variables -- for example, trying to address `f(T, List)` as `f(Object, List)`.
+ val realFunctionId = useFunction(f)
+ DeclarationStackAdjuster(f, OverriddenFunctionAttributes(id, id, locId, nonSyntheticParams, typeParameters = listOf(), isStatic = true)).use {
+ val realParamsVarId = getValueParameterLabel(id, parameterTypes.size - 2)
+ val intType = pluginContext.irBuiltIns.intType
+ val paramIdxOffset = listOf(dispatchReceiver, f.extensionReceiverParameter).count { it != null }
+ extractBlockBody(id, locId).also { blockId ->
+ var nextStmt = 0
+ // For each parameter with a default, sub in the default value if the caller hasn't supplied a value:
+ f.valueParameters.forEachIndexed { paramIdx, param ->
+ val defaultVal = param.defaultValue
+ if (defaultVal != null) {
+ extractIfStmt(locId, blockId, nextStmt++, id).also { ifId ->
+ // if (realParams & thisParamBit == 0) ...
+ extractEqualsExpression(locId, ifId, 0, id, ifId).also { eqId ->
+ extractAndbitExpression(intType, locId, eqId, 0, id, ifId).also { opId ->
+ extractConstantInteger(1 shl paramIdx, locId, opId, 0, id, ifId)
+ extractVariableAccess(tw.getLabelFor(realParamsVarId), intType, locId, opId, 1, id, ifId)
+ }
+ extractConstantInteger(0, locId, eqId, 1, id, ifId)
+ }
+ // thisParamVar = defaultExpr...
+ extractExpressionStmt(locId, ifId, 1, id).also { exprStmtId ->
+ extractAssignExpr(param.type, locId, exprStmtId, 0, id, exprStmtId).also { assignId ->
+ extractVariableAccess(tw.getLabelFor(getValueParameterLabel(id, paramIdx + paramIdxOffset)), param.type, locId, assignId, 0, id, exprStmtId)
+ extractExpressionExpr(defaultVal.expression, id, assignId, 1, exprStmtId)
+ }
+ }
+ }
+ }
+ }
+ // Now call the real function:
+ if (f is IrConstructor) {
+ tw.getFreshIdLabel().also { thisCallId ->
+ tw.writeStmts_constructorinvocationstmt(thisCallId, blockId, nextStmt++, id)
+ tw.writeHasLocation(thisCallId, locId)
+ f.valueParameters.forEachIndexed { idx, param ->
+ extractVariableAccess(tw.getLabelFor(getValueParameterLabel(id, idx)), param.type, locId, thisCallId, idx, id, thisCallId)
+ }
+ tw.writeCallableBinding(thisCallId, realFunctionId)
+ }
+ } else {
+ tw.getFreshIdLabel().also { returnId ->
+ tw.writeStmts_returnstmt(returnId, blockId, nextStmt++, id)
+ tw.writeHasLocation(returnId, locId)
+ extractMethodAccessWithoutArgs(f.returnType, locId, id, returnId, 0, returnId, realFunctionId).also { thisCallId ->
+ val realFnIdxOffset = if (f.extensionReceiverParameter != null) 1 else 0
+ val paramMappings = f.valueParameters.mapIndexed { idx, param -> Triple(param.type, idx + paramIdxOffset, idx + realFnIdxOffset) } +
+ listOfNotNull(
+ dispatchReceiver?.let { Triple(it.type, realFnIdxOffset, -1) },
+ extReceiver?.let { Triple(it.type, 0, 0) }
+ )
+ paramMappings.forEach { (type, fromIdx, toIdx) ->
+ extractVariableAccess(tw.getLabelFor(getValueParameterLabel(id, fromIdx)), type, locId, thisCallId, toIdx, id, returnId)
+ }
+ if (f.shouldExtractAsStatic)
+ extractStaticTypeAccessQualifier(f, thisCallId, locId, id, returnId)
+ else if (f.isLocalFunction()) {
+ extractNewExprForLocalFunction(getLocallyVisibleFunctionLabels(f), thisCallId, locId, id, returnId)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private val jvmOverloadsFqName = FqName("kotlin.jvm.JvmOverloads")
+
+ private fun extractGeneratedOverloads(f: IrFunction, parentId: Label, maybeSourceParentId: Label?, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?) {
+ if (!f.hasAnnotation(jvmOverloadsFqName))
+ return
+
+ fun extractGeneratedOverload(paramList: List) {
+ val overloadParameters = paramList.filterIsInstance()
+ // Note `overloadParameters` have incorrect parents and indices, since there is no actual IrFunction describing the required synthetic overload.
+ // We have to use the `overriddenAttributes` element of `DeclarationStackAdjuster` to fix up references to these parameters while we're extracting
+ // these synthetic overloads.
+ val overloadId = tw.getLabelFor(getFunctionLabel(f, parentId, classTypeArgsIncludingOuterClasses, overloadParameters))
+ val sourceParentId =
+ maybeSourceParentId ?:
+ if (typeSubstitution != null)
+ useDeclarationParent(f.parent, false)
+ else
+ parentId
+ val sourceDeclId = tw.getLabelFor(getFunctionLabel(f, sourceParentId, listOf(), overloadParameters))
+ val overriddenAttributes = OverriddenFunctionAttributes(id = overloadId, sourceDeclarationId = sourceDeclId, valueParameters = overloadParameters)
+ forceExtractFunction(f, parentId, extractBody = false, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, overriddenAttributes = overriddenAttributes)
+ tw.writeCompiler_generated(overloadId, CompilerGeneratedKinds.JVMOVERLOADS_METHOD.kind)
+ val realFunctionLocId = tw.getLocation(f)
+ if (extractBody) {
+
+ DeclarationStackAdjuster(f, overriddenAttributes).use {
+
+ fun extractNormalArgs(argParentId: Label, idxOffset: Int, enclosingStmtId: Label) {
+ paramList.forEachIndexed { idx, param ->
+ when(param) {
+ is IrValueParameter -> {
+ // Forward a parameter:
+ val syntheticParamId = useValueParameter(param, overloadId)
+ extractVariableAccess(syntheticParamId, param.type, realFunctionLocId, argParentId, idxOffset + idx, overloadId, enclosingStmtId)
+ }
+ is IrExpression -> {
+ // Supply a default argument:
+ extractExpressionExpr(param, overloadId, argParentId, idxOffset + idx, enclosingStmtId)
+ }
+ else -> {
+ logger.errorElement("Unexpected parameter list entry", param)
+ }
+ }
+ }
+ }
+
+ // Create a synthetic function body that calls the real function supplying default arguments where required:
+ if (f is IrConstructor) {
+ val blockId = extractBlockBody(overloadId, realFunctionLocId)
+ val constructorCallId = tw.getFreshIdLabel()
+ tw.writeStmts_constructorinvocationstmt(constructorCallId, blockId, 0, overloadId)
+ tw.writeHasLocation(constructorCallId, realFunctionLocId)
+ tw.writeCallableBinding(constructorCallId, useFunction(f))
+
+ extractNormalArgs(constructorCallId, 0, constructorCallId)
+ } else {
+ extractExpressionBody(overloadId, realFunctionLocId).also { returnId ->
+ extractRawMethodAccess(
+ f,
+ realFunctionLocId,
+ f.returnType,
+ overloadId,
+ returnId,
+ 0,
+ returnId,
+ f.valueParameters.size,
+ { argParentId, idxOffset ->
+ extractNormalArgs(argParentId, idxOffset, returnId)
+ },
+ f.dispatchReceiverParameter?.type,
+ f.dispatchReceiverParameter?.let { { callId ->
+ extractThisAccess(it.type, overloadId, callId, -1, returnId, realFunctionLocId)
+ } },
+ f.extensionReceiverParameter?.let { { argParentId ->
+ val syntheticParamId = useValueParameter(it, overloadId)
+ extractVariableAccess(syntheticParamId, it.type, realFunctionLocId, argParentId, 0, overloadId, returnId)
+ } }
+ )
+ }
+ }
+ }
+ }
+ }
+
+ val paramList: MutableList = f.valueParameters.toMutableList()
+ for (n in (paramList.size - 1) downTo 0) {
+ (paramList[n] as? IrValueParameter)?.defaultValue?.expression?.let {
+ paramList[n] = it // Replace the last parameter that has a default with that default value.
+ extractGeneratedOverload(paramList)
+ }
+ }
+ }
+
+ private fun extractConstructor(id: Label, shortName: String, paramsSignature: String, parentId: Label, sourceDeclaration: Label) {
+ val unitType = useType(pluginContext.irBuiltIns.unitType, TypeContext.RETURN)
+ tw.writeConstrs(id, shortName, "$shortName$paramsSignature", unitType.javaResult.id, parentId, sourceDeclaration)
+ tw.writeConstrsKotlinType(id, unitType.kotlinResult.id)
+ }
+
+ private fun extractMethod(id: Label, locId: Label, shortName: String, returnType: IrType, paramsSignature: String, parentId: Label, sourceDeclaration: Label, origin: IrDeclarationOrigin?, extractTypeAccess: Boolean) {
+ val returnTypeResults = useType(returnType, TypeContext.RETURN)
+ tw.writeMethods(id, shortName, "$shortName$paramsSignature", returnTypeResults.javaResult.id, parentId, sourceDeclaration)
+ tw.writeMethodsKotlinType(id, returnTypeResults.kotlinResult.id)
+ when (origin) {
+ IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER ->
+ tw.writeCompiler_generated(id, CompilerGeneratedKinds.GENERATED_DATA_CLASS_MEMBER.kind)
+ IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR ->
+ tw.writeCompiler_generated(id, CompilerGeneratedKinds.DEFAULT_PROPERTY_ACCESSOR.kind)
+ IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER ->
+ tw.writeCompiler_generated(id, CompilerGeneratedKinds.ENUM_CLASS_SPECIAL_MEMBER.kind)
+ }
+ if (extractTypeAccess) {
+ extractTypeAccessRecursive(returnType, locId, id, -1)
+ }
+ }
+
+ private fun signatureOrWarn(t: TypeResult<*>, associatedElement: IrElement?) =
+ t.signature ?: "".also {
+ if (associatedElement != null)
+ logger.warnElement("Needed a signature for a type that doesn't have one", associatedElement)
+ else
+ logger.warn("Needed a signature for a type that doesn't have one")
+ }
+
+ private fun forceExtractFunction(f: IrFunction, parentId: Label, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?, extractOrigin: Boolean = true, overriddenAttributes: OverriddenFunctionAttributes? = null): Label {
with("function", f) {
- DeclarationStackAdjuster(f).use {
+ DeclarationStackAdjuster(f, overriddenAttributes).use {
val javaCallable = getJavaCallable(f)
getFunctionTypeParameters(f).mapIndexed { idx, tp -> extractTypeParameter(tp, idx, (javaCallable as? JavaTypeParameterListOwner)?.typeParameters?.getOrNull(idx)) }
val id =
- idOverride
+ overriddenAttributes?.id
?: // If this is a class that would ordinarily be replaced by a Java equivalent (e.g. kotlin.Map -> java.util.Map),
// don't replace here, really extract the Kotlin version:
useFunction(f, parentId, classTypeArgsIncludingOuterClasses, noReplace = true)
val sourceDeclaration =
- if (typeSubstitution != null && idOverride == null)
- useFunction(f)
- else
- id
+ overriddenAttributes?.sourceDeclarationId ?:
+ if (typeSubstitution != null && overriddenAttributes?.id == null)
+ useFunction(f)
+ else
+ id
val extReceiver = f.extensionReceiverParameter
val idxOffset = if (extReceiver != null) 1 else 0
- val paramTypes = f.valueParameters.mapIndexed { i, vp ->
- extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses, locOverride)
+ val fParameters = overriddenAttributes?.valueParameters ?: f.valueParameters
+ val paramTypes = fParameters.mapIndexed { i, vp ->
+ extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses, overriddenAttributes?.sourceLoc)
}
val allParamTypes = if (extReceiver != null) {
val extendedType = useType(extReceiver.type)
tw.writeKtExtensionFunctions(id.cast(), extendedType.javaResult.id, extendedType.kotlinResult.id)
- val t = extractValueParameter(extReceiver, id, 0, null, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses, locOverride)
+ val t = extractValueParameter(extReceiver, id, 0, null, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses, overriddenAttributes?.sourceLoc)
listOf(t) + paramTypes
} else {
paramTypes
}
- val paramsSignature = allParamTypes.joinToString(separator = ",", prefix = "(", postfix = ")") { it.javaResult.signature }
+ val paramsSignature = allParamTypes.joinToString(separator = ",", prefix = "(", postfix = ")") { signatureOrWarn(it.javaResult, f) }
val adjustedReturnType = addJavaLoweringWildcards(getAdjustedReturnType(f), false, (javaCallable as? JavaMethod)?.returnType)
val substReturnType = typeSubstitution?.let { it(adjustedReturnType, TypeContext.RETURN, pluginContext) } ?: adjustedReturnType
- val locId = locOverride ?: getLocation(f, classTypeArgsIncludingOuterClasses)
+ val locId = overriddenAttributes?.sourceLoc ?: getLocation(f, classTypeArgsIncludingOuterClasses)
if (f.symbol is IrConstructorSymbol) {
- val unitType = useType(pluginContext.irBuiltIns.unitType, TypeContext.RETURN)
val shortName = when {
adjustedReturnType.isAnonymous -> ""
typeSubstitution != null -> useType(substReturnType).javaResult.shortName
else -> adjustedReturnType.classFqName?.shortName()?.asString() ?: f.name.asString()
}
- val constrId = id.cast()
- tw.writeConstrs(constrId, shortName, "$shortName$paramsSignature", unitType.javaResult.id, parentId, sourceDeclaration.cast())
- tw.writeConstrsKotlinType(constrId, unitType.kotlinResult.id)
+ extractConstructor(id.cast(), shortName, paramsSignature, parentId, sourceDeclaration.cast())
} else {
- val returnType = useType(substReturnType, TypeContext.RETURN)
- val shortName = getFunctionShortName(f)
+ val shortNames = getFunctionShortName(f)
val methodId = id.cast()
- tw.writeMethods(methodId, shortName.nameInDB, "${shortName.nameInDB}$paramsSignature", returnType.javaResult.id, parentId, sourceDeclaration.cast())
- tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id)
- if (extractOrigin) {
- when (f.origin) {
- IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER ->
- tw.writeCompiler_generated(methodId, CompilerGeneratedKinds.GENERATED_DATA_CLASS_MEMBER.kind)
- IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR ->
- tw.writeCompiler_generated(methodId, CompilerGeneratedKinds.DEFAULT_PROPERTY_ACCESSOR.kind)
- IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER ->
- tw.writeCompiler_generated(methodId, CompilerGeneratedKinds.ENUM_CLASS_SPECIAL_MEMBER.kind)
- }
- }
+ extractMethod(methodId, locId, shortNames.nameInDB, substReturnType, paramsSignature, parentId, sourceDeclaration.cast(), if (extractOrigin) f.origin else null, extractMethodAndParameterTypeAccesses)
- if (extractMethodAndParameterTypeAccesses) {
- extractTypeAccessRecursive(substReturnType, locId, id, -1)
- }
-
- if (shortName.nameInDB != shortName.kotlinName) {
- tw.writeKtFunctionOriginalNames(methodId, shortName.kotlinName)
+ if (shortNames.nameInDB != shortNames.kotlinName) {
+ tw.writeKtFunctionOriginalNames(methodId, shortNames.kotlinName)
}
if (f.hasInterfaceParent() && f.body != null) {
- addModifiers(id, "default") // The actual output class file may or may not have this modifier, depending on the -Xjvm-default setting.
+ addModifiers(methodId, "default") // The actual output class file may or may not have this modifier, depending on the -Xjvm-default setting.
}
}
@@ -925,6 +1178,8 @@ open class KotlinFileExtractor(
addModifiers(id, "suspend")
}
+ linesOfCode?.linesOfCodeInDeclaration(f, id)
+
return id
}
}
@@ -1028,6 +1283,10 @@ open class KotlinFileExtractor(
}
extractVisibility(p, id, p.visibility)
+
+ if (p.isLateinit) {
+ addModifiers(id, "lateinit")
+ }
}
}
}
@@ -1045,7 +1304,7 @@ open class KotlinFileExtractor(
}
}
- private fun extractEnumEntry(ee: IrEnumEntry, parentId: Label, extractTypeAccess: Boolean) {
+ private fun extractEnumEntry(ee: IrEnumEntry, parentId: Label, extractPrivateMembers: Boolean, extractFunctionBodies: Boolean) {
with("enum entry", ee) {
DeclarationStackAdjuster(ee).use {
val id = useEnumEntry(ee)
@@ -1054,8 +1313,9 @@ open class KotlinFileExtractor(
tw.writeFieldsKotlinType(id, type.kotlinResult.id)
val locId = tw.getLocation(ee)
tw.writeHasLocation(id, locId)
+ tw.writeIsEnumConst(id)
- if (extractTypeAccess) {
+ if (extractFunctionBodies) {
val fieldDeclarationId = tw.getFreshIdLabel()
tw.writeFielddecls(fieldDeclarationId, parentId)
tw.writeFieldDeclaredIn(id, fieldDeclarationId, 0)
@@ -1063,6 +1323,10 @@ open class KotlinFileExtractor(
extractTypeAccess(type, locId, fieldDeclarationId, 0)
}
+
+ ee.correspondingClass?.let {
+ extractDeclaration(it, extractPrivateMembers, extractFunctionBodies)
+ }
}
}
}
@@ -1095,14 +1359,18 @@ open class KotlinFileExtractor(
}
}
+ private fun extractBlockBody(callable: Label, locId: Label) =
+ tw.getFreshIdLabel().also {
+ tw.writeStmts_block(it, callable, 0, callable)
+ tw.writeHasLocation(it, locId)
+ }
+
private fun extractBlockBody(b: IrBlockBody, callable: Label) {
with("block body", b) {
- val id = tw.getFreshIdLabel()
- val locId = tw.getLocation(b)
- tw.writeStmts_block(id, callable, 0, callable)
- tw.writeHasLocation(id, locId)
- for ((sIdx, stmt) in b.statements.withIndex()) {
- extractStatement(stmt, callable, id, sIdx)
+ extractBlockBody(callable, tw.getLocation(b)).also {
+ for ((sIdx, stmt) in b.statements.withIndex()) {
+ extractStatement(stmt, callable, it, sIdx)
+ }
}
}
}
@@ -1125,11 +1393,8 @@ open class KotlinFileExtractor(
}
}
- fun extractExpressionBody(callable: Label, locId: Label): Label {
- val blockId = tw.getFreshIdLabel()
- tw.writeStmts_block(blockId, callable, 0, callable)
- tw.writeHasLocation(blockId, locId)
-
+ fun extractExpressionBody(callable: Label, locId: Label): Label {
+ val blockId = extractBlockBody(callable, locId)
return tw.getFreshIdLabel().also { returnId ->
tw.writeStmts_returnstmt(returnId, blockId, 0, callable)
tw.writeHasLocation(returnId, locId)
@@ -1177,9 +1442,18 @@ open class KotlinFileExtractor(
if (!v.isVar) {
addModifiers(varId, "final")
}
+ if (v.isLateinit) {
+ addModifiers(varId, "lateinit")
+ }
}
}
+ private fun extractIfStmt(locId: Label, parent: Label, idx: Int, callable: Label) =
+ tw.getFreshIdLabel().also {
+ tw.writeStmts_ifstmt(it, parent, idx, callable)
+ tw.writeHasLocation(it, locId)
+ }
+
private fun extractStatement(s: IrStatement, callable: Label, parent: Label, idx: Int) {
with("statement", s) {
when(s) {
@@ -1407,9 +1681,213 @@ open class KotlinFileExtractor(
extractTypeAccessRecursive(pluginContext.irBuiltIns.anyType, locId, idNewexpr, -3, enclosingCallable, enclosingStmt)
}
+ private fun extractMethodAccessWithoutArgs(
+ returnType: IrType,
+ locId: Label,
+ enclosingCallable: Label,
+ callsiteParent: Label,
+ childIdx: Int,
+ enclosingStmt: Label,
+ methodLabel: Label?
+ ) = tw.getFreshIdLabel().also { id ->
+ val type = useType(returnType)
+
+ tw.writeExprs_methodaccess(id, type.javaResult.id, callsiteParent, childIdx)
+ tw.writeExprsKotlinType(id, type.kotlinResult.id)
+ tw.writeHasLocation(id, locId)
+ tw.writeCallableEnclosingExpr(id, enclosingCallable)
+ tw.writeStatementEnclosingExpr(id, enclosingStmt)
+
+ // The caller should have warned about this before, so we don't repeat the warning here.
+ if (methodLabel != null)
+ tw.writeCallableBinding(id, methodLabel)
+ }
+
+ private val defaultConstructorMarkerClass by lazy {
+ val result = pluginContext.referenceClass(FqName("kotlin.jvm.internal.DefaultConstructorMarker"))?.owner
+ result?.let { extractExternalClassLater(it) }
+ result
+ }
+
+ private val defaultConstructorMarkerType by lazy {
+ defaultConstructorMarkerClass?.typeWith()
+ }
+
+ private fun getDefaultsMethodLastArgType(f: IrFunction) =
+ (
+ if (f is IrConstructor)
+ defaultConstructorMarkerType
+ else
+ null
+ ) ?: pluginContext.irBuiltIns.anyType
+
+ private fun getDefaultsMethodArgTypes(f: IrFunction) =
+ // The $default method has type ([extensionReceiver], [dispatchReceiver], paramTypes..., int, Object)
+ // All parameter types are erased. The trailing int is a mask indicating which parameter values are real
+ // and which should be replaced by defaults. The final Object parameter is apparently always null.
+ (
+ listOfNotNull(if (f.shouldExtractAsStatic) null else f.dispatchReceiverParameter?.type) +
+ f.valueParameters.map { it.type } +
+ listOf(pluginContext.irBuiltIns.intType, getDefaultsMethodLastArgType(f))
+ ).map { erase(it) }
+
+ private fun getDefaultsMethodName(f: IrFunction) =
+ if (f is IrConstructor) {
+ f.returnType.let {
+ when {
+ it.isAnonymous -> ""
+ else -> it.classFqName?.shortName()?.asString() ?: f.name.asString()
+ }
+ }
+ } else {
+ getFunctionShortName(f).nameInDB + "\$default"
+ }
+
+ private fun getDefaultsMethodLabel(f: IrFunction): Label {
+ val defaultsMethodName = getDefaultsMethodName(f)
+ val normalArgTypes = getDefaultsMethodArgTypes(f)
+ val extensionParamType = f.extensionReceiverParameter?.let { erase(it.type) }
+
+ val defaultMethodLabelStr = getFunctionLabel(
+ f.parent,
+ maybeParentId = null,
+ defaultsMethodName,
+ normalArgTypes,
+ erase(f.returnType),
+ extensionParamType,
+ listOf(),
+ classTypeArgsIncludingOuterClasses = null,
+ overridesCollectionsMethod = false,
+ javaSignature = null,
+ addParameterWildcardsByDefault = false
+ )
+
+ return tw.getLabelFor(defaultMethodLabelStr)
+ }
+
+ private fun extractsDefaultsCall(
+ syntacticCallTarget: IrFunction,
+ locId: Label,
+ resultType: IrType,
+ enclosingCallable: Label,
+ callsiteParent: Label,
+ childIdx: Int,
+ enclosingStmt: Label,
+ valueArguments: List,
+ dispatchReceiver: IrExpression?,
+ extensionReceiver: IrExpression?
+ ) {
+ val callTarget = syntacticCallTarget.target.realOverrideTarget
+ if (isExternalDeclaration(callTarget)) {
+ // Ensure the real target gets extracted, as we might not every directly touch it thanks to this call being redirected to a $default method.
+ useFunction(callTarget)
+ }
+ val defaultMethodLabel = getDefaultsMethodLabel(callTarget)
+ val id = extractMethodAccessWithoutArgs(resultType, locId, enclosingCallable, callsiteParent, childIdx, enclosingStmt, defaultMethodLabel)
+
+ if (callTarget.isLocalFunction()) {
+ extractTypeAccess(getLocallyVisibleFunctionLabels(callTarget).type, locId, id, -1, enclosingCallable, enclosingStmt)
+ } else {
+ extractStaticTypeAccessQualifierUnchecked(callTarget.parent, id, locId, enclosingCallable, enclosingStmt)
+ }
+
+ extractDefaultsCallArguments(id, callTarget, enclosingCallable, enclosingStmt, valueArguments, dispatchReceiver, extensionReceiver)
+ }
+
+ private fun extractDefaultsCallArguments(
+ id: Label,
+ callTarget: IrFunction,
+ enclosingCallable: Label,
+ enclosingStmt: Label,
+ valueArguments: List,
+ dispatchReceiver: IrExpression?,
+ extensionReceiver: IrExpression?
+ ) {
+ var nextIdx = 0
+ if (extensionReceiver != null) {
+ extractExpressionExpr(extensionReceiver, enclosingCallable, id, nextIdx++, enclosingStmt)
+ }
+ if (dispatchReceiver != null && !callTarget.shouldExtractAsStatic) {
+ extractExpressionExpr(dispatchReceiver, enclosingCallable, id, nextIdx++, enclosingStmt)
+ }
+
+ val valueArgsWithDummies = valueArguments.zip(callTarget.valueParameters).map {
+ (expr, param) -> expr ?: IrConstImpl.defaultValueForType(0, 0, param.type)
+ }
+
+ var realParamsMask = 0
+ valueArguments.forEachIndexed { index, arg -> if (arg != null) realParamsMask = realParamsMask or (1 shl index) }
+
+ val extraArgs = listOf(
+ IrConstImpl.int(0, 0, pluginContext.irBuiltIns.intType, realParamsMask),
+ IrConstImpl.defaultValueForType(0, 0, getDefaultsMethodLastArgType(callTarget))
+ )
+
+ extractCallValueArguments(id, valueArgsWithDummies + extraArgs, enclosingStmt, enclosingCallable, nextIdx)
+ }
+
+ private fun getFunctionInvokeMethod(typeArgs: List): IrFunction? {
+ // For `kotlin.FunctionX` and `kotlin.reflect.KFunctionX` interfaces, we're making sure that we
+ // extract the call to the `invoke` method that does exist, `kotlin.jvm.functions.FunctionX::invoke`.
+ val functionalInterface = getFunctionalInterfaceTypeWithTypeArgs(typeArgs)
+ if (functionalInterface == null) {
+ logger.warn("Cannot find functional interface type for raw method access")
+ return null
+ }
+ val functionalInterfaceClass = functionalInterface.classOrNull
+ if (functionalInterfaceClass == null) {
+ logger.warn("Cannot find functional interface class for raw method access")
+ return null
+ }
+ val interfaceType = functionalInterfaceClass.owner
+ val substituted = getJavaEquivalentClass(interfaceType) ?: interfaceType
+ val function = findFunction(substituted, OperatorNameConventions.INVOKE.asString())
+ if (function == null) {
+ logger.warn("Cannot find invoke function for raw method access")
+ return null
+ }
+ return function
+ }
+
+ private fun isFunctionInvoke(callTarget: IrFunction, drType: IrSimpleType) =
+ (drType.isFunctionOrKFunction() || drType.isSuspendFunctionOrKFunction()) &&
+ callTarget.name.asString() == OperatorNameConventions.INVOKE.asString()
+
+ private fun getCalleeMethodId(callTarget: IrFunction, drType: IrType?, allowInstantiatedGenericMethod: Boolean): Label? {
+ if (callTarget.isLocalFunction())
+ return getLocallyVisibleFunctionLabels(callTarget).function
+
+ if (allowInstantiatedGenericMethod && drType is IrSimpleType && !isUnspecialised(drType, logger)) {
+ val calleeIsInvoke = isFunctionInvoke(callTarget, drType)
+
+ val extractionMethod =
+ if (calleeIsInvoke)
+ getFunctionInvokeMethod(drType.arguments)
+ else
+ callTarget
+
+ return extractionMethod?.let {
+ val typeArgs =
+ if (calleeIsInvoke && drType.arguments.size > BuiltInFunctionArity.BIG_ARITY) {
+ // Big arity `invoke` methods have a special implementation on JVM, they are transformed to a call to
+ // `kotlin.jvm.functions.FunctionN::invoke(vararg args: Any?)`, so we only need to pass the type
+ // argument for the return type. Additionally, the arguments are extracted inside an array literal below.
+ listOf(drType.arguments.last())
+ } else {
+ getDeclaringTypeArguments(callTarget, drType)
+ }
+ useFunction(extractionMethod, typeArgs)
+ }
+ }
+ else {
+ return useFunction(callTarget)
+ }
+ }
+
fun extractRawMethodAccess(
syntacticCallTarget: IrFunction,
- callsite: IrCall,
+ locElement: IrElement,
+ resultType: IrType,
enclosingCallable: Label,
callsiteParent: Label,
childIdx: Int,
@@ -1421,29 +1899,42 @@ open class KotlinFileExtractor(
extractClassTypeArguments: Boolean = false,
superQualifierSymbol: IrClassSymbol? = null) {
- val locId = tw.getLocation(callsite)
-
- extractRawMethodAccess(
- syntacticCallTarget,
- locId,
- callsite.type,
- enclosingCallable,
- callsiteParent,
- childIdx,
- enclosingStmt,
- valueArguments.size,
- { argParent, idxOffset -> extractCallValueArguments(argParent, valueArguments, enclosingStmt, enclosingCallable, idxOffset) },
- dispatchReceiver?.type,
- dispatchReceiver?.let { { callId -> extractExpressionExpr(dispatchReceiver, enclosingCallable, callId, -1, enclosingStmt) } },
- extensionReceiver?.let { { argParent -> extractExpressionExpr(extensionReceiver, enclosingCallable, argParent, 0, enclosingStmt) } },
- typeArguments,
- extractClassTypeArguments,
- superQualifierSymbol
- )
+ val locId = tw.getLocation(locElement)
+ if (valueArguments.any { it == null }) {
+ extractsDefaultsCall(
+ syntacticCallTarget,
+ locId,
+ resultType,
+ enclosingCallable,
+ callsiteParent,
+ childIdx,
+ enclosingStmt,
+ valueArguments,
+ dispatchReceiver,
+ extensionReceiver
+ )
+ } else {
+ extractRawMethodAccess(
+ syntacticCallTarget,
+ locId,
+ resultType,
+ enclosingCallable,
+ callsiteParent,
+ childIdx,
+ enclosingStmt,
+ valueArguments.size,
+ { argParent, idxOffset -> extractCallValueArguments(argParent, valueArguments, enclosingStmt, enclosingCallable, idxOffset) },
+ dispatchReceiver?.type,
+ dispatchReceiver?.let { { callId -> extractExpressionExpr(dispatchReceiver, enclosingCallable, callId, -1, enclosingStmt) } },
+ extensionReceiver?.let { { argParent -> extractExpressionExpr(extensionReceiver, enclosingCallable, argParent, 0, enclosingStmt) } },
+ typeArguments,
+ extractClassTypeArguments,
+ superQualifierSymbol
+ )
+ }
}
-
fun extractRawMethodAccess(
syntacticCallTarget: IrFunction,
locId: Label,
@@ -1462,98 +1953,32 @@ open class KotlinFileExtractor(
superQualifierSymbol: IrClassSymbol? = null) {
val callTarget = syntacticCallTarget.target.realOverrideTarget
- val id = tw.getFreshIdLabel()
- val type = useType(returnType)
+ val methodId = getCalleeMethodId(callTarget, drType, extractClassTypeArguments)
+ if (methodId == null) {
+ logger.warn("No method to bind call to for raw method access")
+ }
- tw.writeExprs_methodaccess(id, type.javaResult.id, callsiteParent, childIdx)
- tw.writeExprsKotlinType(id, type.kotlinResult.id)
- tw.writeHasLocation(id, locId)
- tw.writeCallableEnclosingExpr(id, enclosingCallable)
- tw.writeStatementEnclosingExpr(id, enclosingStmt)
+ val id = extractMethodAccessWithoutArgs(returnType, locId, enclosingCallable, callsiteParent, childIdx, enclosingStmt, methodId)
// type arguments at index -2, -3, ...
extractTypeArguments(typeArguments, locId, id, enclosingCallable, enclosingStmt, -2, true)
- val (isFunctionInvoke, isBigArityFunctionInvoke) =
- if (drType is IrSimpleType &&
- (drType.isFunctionOrKFunction() || drType.isSuspendFunctionOrKFunction()) &&
- callTarget.name.asString() == OperatorNameConventions.INVOKE.asString()) {
- Pair(true, drType.arguments.size > BuiltInFunctionArity.BIG_ARITY)
- } else {
- Pair(false, false)
- }
-
if (callTarget.isLocalFunction()) {
- val ids = getLocallyVisibleFunctionLabels(callTarget)
-
- val methodId = ids.function
- tw.writeCallableBinding(id, methodId)
-
- extractNewExprForLocalFunction(ids, id, locId, enclosingCallable, enclosingStmt)
- } else {
- val methodId =
- if (extractClassTypeArguments && drType is IrSimpleType && !isUnspecialised(drType, logger)) {
-
- val extractionMethod = if (isFunctionInvoke) {
- // For `kotlin.FunctionX` and `kotlin.reflect.KFunctionX` interfaces, we're making sure that we
- // extract the call to the `invoke` method that does exist, `kotlin.jvm.functions.FunctionX::invoke`.
- val functionalInterface = getFunctionalInterfaceTypeWithTypeArgs(drType.arguments)
- if (functionalInterface == null) {
- logger.warn("Cannot find functional interface type for raw method access")
- null
- } else {
- val functionalInterfaceClass = functionalInterface.classOrNull
- if (functionalInterfaceClass == null) {
- logger.warn("Cannot find functional interface class for raw method access")
- null
- } else {
- val interfaceType = functionalInterfaceClass.owner
- val substituted = getJavaEquivalentClass(interfaceType) ?: interfaceType
- val function = findFunction(substituted, OperatorNameConventions.INVOKE.asString())
- if (function == null) {
- logger.warn("Cannot find invoke function for raw method access")
- null
- } else {
- function
- }
- }
- }
- } else {
- callTarget
- }
-
- if (extractionMethod == null) {
- null
- } else if (isBigArityFunctionInvoke) {
- // Big arity `invoke` methods have a special implementation on JVM, they are transformed to a call to
- // `kotlin.jvm.functions.FunctionN::invoke(vararg args: Any?)`, so we only need to pass the type
- // argument for the return type. Additionally, the arguments are extracted inside an array literal below.
- useFunction(extractionMethod, listOf(drType.arguments.last()))
- } else {
- useFunction(extractionMethod, getDeclaringTypeArguments(callTarget, drType))
- }
- }
- else {
- useFunction(callTarget)
- }
-
- if (methodId == null) {
- logger.warn("No method to bind call to for raw method access")
- } else {
- tw.writeCallableBinding(id, methodId)
- }
-
- if (callTarget.shouldExtractAsStatic) {
- extractStaticTypeAccessQualifier(callTarget, id, locId, enclosingCallable, enclosingStmt)
- } else if (superQualifierSymbol != null) {
- extractSuperAccess(superQualifierSymbol.typeWith(), enclosingCallable, id, -1, enclosingStmt, locId)
- } else if (extractDispatchReceiver != null) {
- extractDispatchReceiver(id)
- }
+ extractNewExprForLocalFunction(getLocallyVisibleFunctionLabels(callTarget), id, locId, enclosingCallable, enclosingStmt)
+ } else if (callTarget.shouldExtractAsStatic) {
+ extractStaticTypeAccessQualifier(callTarget, id, locId, enclosingCallable, enclosingStmt)
+ } else if (superQualifierSymbol != null) {
+ extractSuperAccess(superQualifierSymbol.typeWith(), enclosingCallable, id, -1, enclosingStmt, locId)
+ } else if (extractDispatchReceiver != null) {
+ extractDispatchReceiver(id)
}
val idxOffset = if (extractExtensionReceiver != null) 1 else 0
+ val isBigArityFunctionInvoke = drType is IrSimpleType &&
+ isFunctionInvoke(callTarget, drType) &&
+ drType.arguments.size > BuiltInFunctionArity.BIG_ARITY
+
val argParent = if (isBigArityFunctionInvoke) {
extractArrayCreationWithInitializer(id, nValueArguments + idxOffset, locId, enclosingCallable, enclosingStmt)
} else {
@@ -1567,16 +1992,19 @@ open class KotlinFileExtractor(
extractValueArguments(argParent, idxOffset)
}
+ private fun extractStaticTypeAccessQualifierUnchecked(parent: IrDeclarationParent, parentExpr: Label, locId: Label, enclosingCallable: Label, enclosingStmt: Label) {
+ if (parent is IrClass) {
+ extractTypeAccessRecursive(parent.toRawType(), locId, parentExpr, -1, enclosingCallable, enclosingStmt)
+ } else if (parent is IrFile) {
+ extractTypeAccess(useFileClassType(parent), locId, parentExpr, -1, enclosingCallable, enclosingStmt)
+ } else {
+ logger.warnElement("Unexpected static type access qualifier ${parent.javaClass}", parent)
+ }
+ }
+
private fun extractStaticTypeAccessQualifier(target: IrDeclaration, parentExpr: Label, locId: Label, enclosingCallable: Label, enclosingStmt: Label) {
if (target.shouldExtractAsStatic) {
- val parent = target.parent
- if (parent is IrClass) {
- extractTypeAccessRecursive(parent.toRawType(), locId, parentExpr, -1, enclosingCallable, enclosingStmt)
- } else if (parent is IrFile) {
- extractTypeAccess(useFileClassType(parent), locId, parentExpr, -1, enclosingCallable, enclosingStmt)
- } else {
- logger.warnElement("Unexpected static type access qualifer ${parent.javaClass}", target)
- }
+ extractStaticTypeAccessQualifierUnchecked(target.parent, parentExpr, locId, enclosingCallable, enclosingStmt)
}
}
@@ -1765,6 +2193,8 @@ open class KotlinFileExtractor(
isFunction(target, "kotlin", "Double", fName)
}
+ private fun isNumericFunction(target: IrFunction, fNames: List) = fNames.any { isNumericFunction(target, it) }
+
private fun isArrayType(typeName: String) =
when(typeName) {
"Array" -> true
@@ -1819,7 +2249,7 @@ open class KotlinFileExtractor(
return
}
- extractRawMethodAccess(syntacticCallTarget, c, callable, parent, idx, enclosingStmt, (0 until c.valueArgumentsCount).map { c.getValueArgument(it) }, c.dispatchReceiver, c.extensionReceiver, typeArgs, extractClassTypeArguments, c.superQualifierSymbol)
+ extractRawMethodAccess(syntacticCallTarget, c, c.type, callable, parent, idx, enclosingStmt, (0 until c.valueArgumentsCount).map { c.getValueArgument(it) }, c.dispatchReceiver, c.extensionReceiver, typeArgs, extractClassTypeArguments, c.superQualifierSymbol)
}
fun extractSpecialEnumFunction(fnName: String){
@@ -1885,6 +2315,22 @@ open class KotlinFileExtractor(
}
}
+ fun unaryopReceiver(id: Label, receiver: IrExpression?, receiverDescription: String) {
+ val locId = tw.getLocation(c)
+ tw.writeHasLocation(id, locId)
+ tw.writeCallableEnclosingExpr(id, callable)
+ tw.writeStatementEnclosingExpr(id, enclosingStmt)
+
+ if(receiver == null) {
+ logger.errorElement("$receiverDescription not found", c)
+ } else {
+ extractExpressionExpr(receiver, callable, id, 0, enclosingStmt)
+ }
+ if(c.valueArgumentsCount > 0) {
+ logger.errorElement("Extra arguments found", c)
+ }
+ }
+
/**
* Populate the lhs of a binary op from this call's dispatch receiver, and the rhs from its sole argument.
*/
@@ -1892,57 +2338,87 @@ open class KotlinFileExtractor(
binopReceiver(id, c.dispatchReceiver, "Dispatch receiver")
}
- /**
- * Populate the lhs of a binary op from this call's extension receiver, and the rhs from its sole argument.
- */
- fun binopExtensionMethod(id: Label) {
- binopReceiver(id, c.extensionReceiver, "Extension receiver")
+ fun unaryopDisp(id: Label) {
+ unaryopReceiver(id, c.dispatchReceiver, "Dispatch receiver")
}
val dr = c.dispatchReceiver
when {
- c.origin == IrStatementOrigin.PLUS &&
- (isNumericFunction(target, "plus")
- || isFunction(target, "kotlin", "String", "plus", null)) -> {
+ isFunction(target, "kotlin", "String", "plus", false) -> {
val id = tw.getFreshIdLabel()
val type = useType(c.type)
tw.writeExprs_addexpr(id, type.javaResult.id, parent, idx)
tw.writeExprsKotlinType(id, type.kotlinResult.id)
- if (c.extensionReceiver != null)
- binopExtensionMethod(id)
- else
- binopDisp(id)
+ binopDisp(id)
}
isFunction(target, "kotlin", "String", "plus", true) -> {
findJdkIntrinsicOrWarn("stringPlus", c)?.let { stringPlusFn ->
- extractRawMethodAccess(stringPlusFn, c, callable, parent, idx, enclosingStmt, listOf(c.extensionReceiver, c.getValueArgument(0)), null, null)
+ extractRawMethodAccess(stringPlusFn, c, c.type, callable, parent, idx, enclosingStmt, listOf(c.extensionReceiver, c.getValueArgument(0)), null, null)
}
}
- c.origin == IrStatementOrigin.MINUS && isNumericFunction(target, "minus") -> {
- val id = tw.getFreshIdLabel()
+ isNumericFunction(target, listOf("plus", "minus", "times", "div", "rem", "and", "or", "xor", "shl", "shr", "ushr")) -> {
val type = useType(c.type)
- tw.writeExprs_subexpr(id, type.javaResult.id, parent, idx)
- tw.writeExprsKotlinType(id, type.kotlinResult.id)
- binopDisp(id)
- }
- c.origin == IrStatementOrigin.MUL && isNumericFunction(target, "times") -> {
- val id = tw.getFreshIdLabel()
- val type = useType(c.type)
- tw.writeExprs_mulexpr(id, type.javaResult.id, parent, idx)
- tw.writeExprsKotlinType(id, type.kotlinResult.id)
- binopDisp(id)
- }
- c.origin == IrStatementOrigin.DIV && isNumericFunction(target, "div") -> {
- val id = tw.getFreshIdLabel()
- val type = useType(c.type)
- tw.writeExprs_divexpr(id, type.javaResult.id, parent, idx)
- tw.writeExprsKotlinType(id, type.kotlinResult.id)
- binopDisp(id)
- }
- c.origin == IrStatementOrigin.PERC && isNumericFunction(target, "rem") -> {
- val id = tw.getFreshIdLabel()
- val type = useType(c.type)
- tw.writeExprs_remexpr(id, type.javaResult.id, parent, idx)
+ val id: Label = when (val targetName = target.name.asString()) {
+ "plus" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_addexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "minus" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_subexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "times" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_mulexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "div" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_divexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "rem" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_remexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "and" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_andbitexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "or" -> {
+ val id = tw.getFreshIdLabel()
+ tw.writeExprs_orbitexpr(id, type.javaResult.id, parent, idx)
+ id
+ }
+ "xor" -> {
+ val id = tw.getFreshIdLabel