Skip to content

Commit 6fde31f

Browse files
Update CodeQL submodule to v2.13.3 (#13)
* Update CodeQL submodule to v2.13.3 * Replace usage of deprecated CodeQL library classes * Adjust getCompleteJavadocText expected test output due to CodeQL lib changes --------- Co-authored-by: Marcono1234 <[email protected]>
1 parent 371c449 commit 6fde31f

12 files changed

+41
-41
lines changed

codeql

Submodule codeql updated 10765 files

codeql-custom-queries-java/queries/error-prone/bitmask-then-right-shift.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from AndBitwiseExpr andExpr, BinaryExpr shiftExpr
1818
where
1919
shiftExpr.getLeftOperand() = andExpr
2020
and andExpr.getAnOperand() instanceof CompileTimeConstantExpr
21-
and (shiftExpr instanceof RShiftExpr or shiftExpr instanceof URShiftExpr)
21+
and (shiftExpr instanceof RightShiftExpr or shiftExpr instanceof UnsignedRightShiftExpr)
2222
// Only consider if shift distance is constant
2323
and shiftExpr.getRightOperand() instanceof CompileTimeConstantExpr
2424
select andExpr, "Should first perform shift and then apply bitmask"

codeql-custom-queries-java/queries/error-prone/mixed-binary-operators-without-parentheses.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class ArithmeticKind extends BinaryExprKind {
4141

4242
class ShiftKind extends BinaryExprKind {
4343
ShiftKind() {
44-
this instanceof LShiftExpr
45-
or this instanceof RShiftExpr
46-
or this instanceof URShiftExpr
44+
this instanceof LeftShiftExpr
45+
or this instanceof RightShiftExpr
46+
or this instanceof UnsignedRightShiftExpr
4747
}
4848

4949
override predicate shouldBeParenthesized(BinaryExprKind op) {

codeql-custom-queries-java/queries/lib/Expressions.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ class BitwiseExpr_ extends Expr {
3636
or this instanceof AssignAndExpr
3737
or this instanceof AssignOrExpr
3838
or this instanceof AssignXorExpr
39-
or this instanceof LShiftExpr
40-
or this instanceof AssignLShiftExpr
41-
or this instanceof RShiftExpr
42-
or this instanceof AssignRShiftExpr
43-
or this instanceof URShiftExpr
44-
or this instanceof AssignURShiftExpr
39+
or this instanceof LeftShiftExpr
40+
or this instanceof AssignLeftShiftExpr
41+
or this instanceof RightShiftExpr
42+
or this instanceof AssignRightShiftExpr
43+
or this instanceof UnsignedRightShiftExpr
44+
or this instanceof AssignUnsignedRightShiftExpr
4545
}
4646
}
4747

codeql-custom-queries-java/queries/lib/Operations.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ class LeftShift extends Shift {
133133

134134
LeftShift() {
135135
rightOperand = [
136-
this.(LShiftExpr).getRightOperand(),
137-
this.(AssignLShiftExpr).getRhs()
136+
this.(LeftShiftExpr).getRightOperand(),
137+
this.(AssignLeftShiftExpr).getRhs()
138138
]
139139
}
140140

141141
override
142142
Expr getLeftOperand() {
143-
result = this.(LShiftExpr).getLeftOperand()
143+
result = this.(LeftShiftExpr).getLeftOperand()
144144
}
145145

146146
override
@@ -154,14 +154,14 @@ class RightShift extends Shift {
154154

155155
RightShift() {
156156
rightOperand = [
157-
this.(RShiftExpr).getRightOperand(),
158-
this.(AssignRShiftExpr).getRhs()
157+
this.(RightShiftExpr).getRightOperand(),
158+
this.(AssignRightShiftExpr).getRhs()
159159
]
160160
}
161161

162162
override
163163
Expr getLeftOperand() {
164-
result = this.(RShiftExpr).getLeftOperand()
164+
result = this.(RightShiftExpr).getLeftOperand()
165165
}
166166

167167
override
@@ -175,14 +175,14 @@ class URightShift extends Shift {
175175

176176
URightShift() {
177177
rightOperand = [
178-
this.(URShiftExpr).getRightOperand(),
179-
this.(AssignURShiftExpr).getRhs()
178+
this.(UnsignedRightShiftExpr).getRightOperand(),
179+
this.(AssignUnsignedRightShiftExpr).getRhs()
180180
]
181181
}
182182

183183
override
184184
Expr getLeftOperand() {
185-
result = this.(URShiftExpr).getLeftOperand()
185+
result = this.(UnsignedRightShiftExpr).getLeftOperand()
186186
}
187187

188188
override

codeql-custom-queries-java/queries/likely-bugs/bitmask-then-right-shift-selecting-wrong-bits.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ from AndBitwiseExpr andExpr, BinaryExpr shiftExpr, int bitmask, int firstBitmask
1212
where
1313
shiftExpr.getLeftOperand() = andExpr
1414
and bitmask = andExpr.getAnOperand().(CompileTimeConstantExpr).getIntValue()
15-
and (shiftExpr instanceof RShiftExpr or shiftExpr instanceof URShiftExpr)
15+
and (shiftExpr instanceof RightShiftExpr or shiftExpr instanceof UnsignedRightShiftExpr)
1616
and shiftDistance = shiftExpr.getRightOperand().(CompileTimeConstantExpr).getIntValue()
1717
and firstBitmaskBitIndex = [0..31]
1818
and bitmask.bitAnd(1.bitShiftLeft(firstBitmaskBitIndex)) != 0

codeql-custom-queries-java/queries/likely-bugs/bitwise-shift-distance-out-of-range.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class ShiftExpr extends Expr {
3737

3838
ShiftExpr() {
3939
shiftDistance = [
40-
this.(LShiftExpr).getRightOperand(),
41-
this.(AssignLShiftExpr).getRhs(),
42-
this.(RShiftExpr).getRightOperand(),
43-
this.(AssignRShiftExpr).getRhs(),
44-
this.(URShiftExpr).getRightOperand(),
45-
this.(AssignURShiftExpr).getRhs()
40+
this.(LeftShiftExpr).getRightOperand(),
41+
this.(AssignLeftShiftExpr).getRhs(),
42+
this.(RightShiftExpr).getRightOperand(),
43+
this.(AssignRightShiftExpr).getRhs(),
44+
this.(UnsignedRightShiftExpr).getRightOperand(),
45+
this.(AssignUnsignedRightShiftExpr).getRhs()
4646
]
4747
}
4848

codeql-custom-queries-java/queries/likely-bugs/signed-rshift-on-loop-variable.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ where
1818
loop.getCondition() = notZeroCheck
1919
and (
2020
notZeroCheck.getAnOperand() = var.getAnAccess()
21-
or notZeroCheck.getAnOperand().(AssignRShiftExpr) = shift
21+
or notZeroCheck.getAnOperand().(AssignRightShiftExpr) = shift
2222
)
2323
and notZeroCheck.getAnOperand().(Literal).getValue() = "0"
2424
)
@@ -33,7 +33,7 @@ where
3333
)
3434
and (
3535
bitAnd.getAnOperand() = var.getAnAccess()
36-
or bitAnd.getAnOperand().(AssignRShiftExpr) = shift
36+
or bitAnd.getAnOperand().(AssignRightShiftExpr) = shift
3737
)
3838
)
3939
)
@@ -43,10 +43,10 @@ where
4343
exists(AssignExpr assign |
4444
assign.getDest() = var.getAnAccess()
4545
and assign.getRhs() = shift
46-
and shift.(RShiftExpr).getLeftOperand() = var.getAnAccess()
46+
and shift.(RightShiftExpr).getLeftOperand() = var.getAnAccess()
4747
and assign.getAnEnclosingStmt() = loop
4848
)
4949
// Or `x >>= ...`
50-
or shift.(AssignRShiftExpr).getDest() = var.getAnAccess()
50+
or shift.(AssignRightShiftExpr).getDest() = var.getAnAccess()
5151
)
5252
select check, "Might result in endless loop due to $@", shift, "this signed right shift"

codeql-custom-queries-java/queries/likely-bugs/wrong-shift-precedence.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import java
1616

1717
class ShiftExpr extends BinaryExpr {
1818
ShiftExpr() {
19-
this instanceof LShiftExpr
20-
or this instanceof RShiftExpr
21-
or this instanceof URShiftExpr
19+
this instanceof LeftShiftExpr
20+
or this instanceof RightShiftExpr
21+
or this instanceof UnsignedRightShiftExpr
2222
}
2323
}
2424

codeql-custom-queries-java/queries/recommendations/bitwise-shift-instead-of-arithmetic-operation.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class ShiftExpr extends Expr {
2121
exists(IntegralLiteral i | shiftDistance = i.getIntValue() |
2222
isLeftShift = true
2323
and i = [
24-
this.(LShiftExpr).getRightOperand(),
25-
this.(AssignLShiftExpr).getRhs()
24+
this.(LeftShiftExpr).getRightOperand(),
25+
this.(AssignLeftShiftExpr).getRhs()
2626
]
2727
or
2828
isLeftShift = false
2929
and i = [
30-
this.(RShiftExpr).getRightOperand(),
31-
this.(AssignRShiftExpr).getRhs()
30+
this.(RightShiftExpr).getRightOperand(),
31+
this.(AssignRightShiftExpr).getRhs()
3232
// Don't consider unsigned right shift because it is not equivalent to division
3333
]
3434
)

0 commit comments

Comments
 (0)