Skip to content

Commit 4ebf3ad

Browse files
committed
Rust: Address review comments.
1 parent 95289b8 commit 4ebf3ad

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

rust/ql/lib/codeql/rust/elements/ComparisonOperation.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ private import codeql.rust.elements.BinaryExpr
66
private import codeql.rust.elements.Operation
77

88
/**
9-
* A comparison operation, such as `==`, `<` or `>=`.
9+
* A comparison operation, such as `==`, `<`, or `>=`.
1010
*/
1111
abstract private class ComparisonOperationImpl extends Operation { }
1212

@@ -22,7 +22,7 @@ final class EqualityOperation = EqualityOperationImpl;
2222
/**
2323
* The equal comparison operation, `==`.
2424
*/
25-
final class EqualOperation extends EqualityOperationImpl, BinaryExpr {
25+
final class EqualOperation extends EqualityOperationImpl {
2626
EqualOperation() { this.getOperatorName() = "==" }
2727
}
2828

@@ -59,7 +59,7 @@ final class RelationalOperation = RelationalOperationImpl;
5959
/**
6060
* The less than comparison operation, `<`.
6161
*/
62-
final class LessThanOperation extends RelationalOperationImpl, BinaryExpr {
62+
final class LessThanOperation extends RelationalOperationImpl {
6363
LessThanOperation() { this.getOperatorName() = "<" }
6464

6565
override Expr getGreaterOperand() { result = this.getRhs() }
@@ -70,7 +70,7 @@ final class LessThanOperation extends RelationalOperationImpl, BinaryExpr {
7070
/**
7171
* The greater than comparison operation, `>`.
7272
*/
73-
final class GreaterThanOperation extends RelationalOperationImpl, BinaryExpr {
73+
final class GreaterThanOperation extends RelationalOperationImpl {
7474
GreaterThanOperation() { this.getOperatorName() = ">" }
7575

7676
override Expr getGreaterOperand() { result = this.getLhs() }
@@ -81,7 +81,7 @@ final class GreaterThanOperation extends RelationalOperationImpl, BinaryExpr {
8181
/**
8282
* The less than or equal comparison operation, `<=`.
8383
*/
84-
final class LessOrEqualOperation extends RelationalOperationImpl, BinaryExpr {
84+
final class LessOrEqualOperation extends RelationalOperationImpl {
8585
LessOrEqualOperation() { this.getOperatorName() = "<=" }
8686

8787
override Expr getGreaterOperand() { result = this.getRhs() }
@@ -92,7 +92,7 @@ final class LessOrEqualOperation extends RelationalOperationImpl, BinaryExpr {
9292
/**
9393
* The greater than or equal comparison operation, `>=`.
9494
*/
95-
final class GreaterOrEqualOperation extends RelationalOperationImpl, BinaryExpr {
95+
final class GreaterOrEqualOperation extends RelationalOperationImpl {
9696
GreaterOrEqualOperation() { this.getOperatorName() = ">=" }
9797

9898
override Expr getGreaterOperand() { result = this.getLhs() }

rust/ql/lib/codeql/rust/security/UncontrolledAllocationSizeExtensions.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ module UncontrolledAllocationSize {
5555
node = cmp.(RelationalOperation).getGreaterOperand().getACfgNode() and
5656
branch = false
5757
or
58-
cmp.getOperatorName() = "==" and
58+
cmp instanceof EqualOperation and
5959
[cmp.getLhs(), cmp.getRhs()].getACfgNode() = node and
6060
branch = true
6161
or
62-
cmp.getOperatorName() = "!=" and
62+
cmp instanceof NotEqualOperation and
6363
[cmp.getLhs(), cmp.getRhs()].getACfgNode() = node and
6464
branch = false
6565
)

0 commit comments

Comments
 (0)