Skip to content

Commit aa4d002

Browse files
authored
Merge pull request #349 from github/aibaars/bump-codeql-main
Bump codeql submodule on main
2 parents 6a18aa4 + f400340 commit aa4d002

File tree

10 files changed

+233
-59
lines changed

10 files changed

+233
-59
lines changed

codeql

Submodule codeql updated 966 files

ql/lib/codeql/ruby/dataflow/internal/DataFlowDispatch.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ class DataFlowCall extends TDataFlowCall {
8383

8484
/** Gets the location of this call. */
8585
Location getLocation() { none() }
86+
87+
/**
88+
* Holds if this element is at the specified location.
89+
* The location spans column `startcolumn` of line `startline` to
90+
* column `endcolumn` of line `endline` in file `filepath`.
91+
* For more information, see
92+
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
93+
*/
94+
predicate hasLocationInfo(
95+
string filepath, int startline, int startcolumn, int endline, int endcolumn
96+
) {
97+
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
98+
}
8699
}
87100

88101
/**

ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl.qll

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,8 @@ private predicate expensiveLen2unfolding(TypedContent tc, Configuration config)
21392139
) and
21402140
accessPathApproxCostLimits(apLimit, tupleLimit) and
21412141
apLimit < tails and
2142-
tupleLimit < (tails - 1) * nodes
2142+
tupleLimit < (tails - 1) * nodes and
2143+
not tc.forceHighPrecision()
21432144
)
21442145
}
21452146

@@ -2973,12 +2974,15 @@ private AccessPathApprox getATail(AccessPathApprox apa, Configuration config) {
29732974
* expected to be expensive. Holds with `unfold = true` otherwise.
29742975
*/
29752976
private predicate evalUnfold(AccessPathApprox apa, boolean unfold, Configuration config) {
2976-
exists(int aps, int nodes, int apLimit, int tupleLimit |
2977-
aps = countPotentialAps(apa, config) and
2978-
nodes = countNodesUsingAccessPath(apa, config) and
2979-
accessPathCostLimits(apLimit, tupleLimit) and
2980-
if apLimit < aps and tupleLimit < (aps - 1) * nodes then unfold = false else unfold = true
2981-
)
2977+
if apa.getHead().forceHighPrecision()
2978+
then unfold = true
2979+
else
2980+
exists(int aps, int nodes, int apLimit, int tupleLimit |
2981+
aps = countPotentialAps(apa, config) and
2982+
nodes = countNodesUsingAccessPath(apa, config) and
2983+
accessPathCostLimits(apLimit, tupleLimit) and
2984+
if apLimit < aps and tupleLimit < (aps - 1) * nodes then unfold = false else unfold = true
2985+
)
29822986
}
29832987

29842988
/**
@@ -3248,7 +3252,7 @@ class PathNode extends TPathNode {
32483252
* The location spans column `startcolumn` of line `startline` to
32493253
* column `endcolumn` of line `endline` in file `filepath`.
32503254
* For more information, see
3251-
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
3255+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
32523256
*/
32533257
predicate hasLocationInfo(
32543258
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -4033,7 +4037,7 @@ private module FlowExploration {
40334037
* The location spans column `startcolumn` of line `startline` to
40344038
* column `endcolumn` of line `endline` in file `filepath`.
40354039
* For more information, see
4036-
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
4040+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
40374041
*/
40384042
predicate hasLocationInfo(
40394043
string filepath, int startline, int startcolumn, int endline, int endcolumn

ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,8 @@ private predicate expensiveLen2unfolding(TypedContent tc, Configuration config)
21392139
) and
21402140
accessPathApproxCostLimits(apLimit, tupleLimit) and
21412141
apLimit < tails and
2142-
tupleLimit < (tails - 1) * nodes
2142+
tupleLimit < (tails - 1) * nodes and
2143+
not tc.forceHighPrecision()
21432144
)
21442145
}
21452146

@@ -2973,12 +2974,15 @@ private AccessPathApprox getATail(AccessPathApprox apa, Configuration config) {
29732974
* expected to be expensive. Holds with `unfold = true` otherwise.
29742975
*/
29752976
private predicate evalUnfold(AccessPathApprox apa, boolean unfold, Configuration config) {
2976-
exists(int aps, int nodes, int apLimit, int tupleLimit |
2977-
aps = countPotentialAps(apa, config) and
2978-
nodes = countNodesUsingAccessPath(apa, config) and
2979-
accessPathCostLimits(apLimit, tupleLimit) and
2980-
if apLimit < aps and tupleLimit < (aps - 1) * nodes then unfold = false else unfold = true
2981-
)
2977+
if apa.getHead().forceHighPrecision()
2978+
then unfold = true
2979+
else
2980+
exists(int aps, int nodes, int apLimit, int tupleLimit |
2981+
aps = countPotentialAps(apa, config) and
2982+
nodes = countNodesUsingAccessPath(apa, config) and
2983+
accessPathCostLimits(apLimit, tupleLimit) and
2984+
if apLimit < aps and tupleLimit < (aps - 1) * nodes then unfold = false else unfold = true
2985+
)
29822986
}
29832987

29842988
/**
@@ -3248,7 +3252,7 @@ class PathNode extends TPathNode {
32483252
* The location spans column `startcolumn` of line `startline` to
32493253
* column `endcolumn` of line `endline` in file `filepath`.
32503254
* For more information, see
3251-
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
3255+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
32523256
*/
32533257
predicate hasLocationInfo(
32543258
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -4033,7 +4037,7 @@ private module FlowExploration {
40334037
* The location spans column `startcolumn` of line `startline` to
40344038
* column `endcolumn` of line `endline` in file `filepath`.
40354039
* For more information, see
4036-
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
4040+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
40374041
*/
40384042
predicate hasLocationInfo(
40394043
string filepath, int startline, int startcolumn, int endline, int endcolumn

ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,13 @@ class TypedContent extends MkTypedContent {
12361236

12371237
/** Gets a textual representation of this content. */
12381238
string toString() { result = c.toString() }
1239+
1240+
/**
1241+
* Holds if access paths with this `TypedContent` at their head always should
1242+
* be tracked at high precision. This disables adaptive access path precision
1243+
* for such access paths.
1244+
*/
1245+
predicate forceHighPrecision() { forceHighPrecision(c) }
12391246
}
12401247

12411248
/**

ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,12 @@ class DataFlowExpr = CfgNodes::ExprCfgNode;
726726

727727
int accessPathLimit() { result = 5 }
728728

729+
/**
730+
* Holds if access paths with `c` at their head always should be tracked at high
731+
* precision. This disables adaptive access path precision for such access paths.
732+
*/
733+
predicate forceHighPrecision(Content c) { none() }
734+
729735
/** The unit type. */
730736
private newtype TUnit = TMkUnit()
731737

0 commit comments

Comments
 (0)