Skip to content

Commit fcdb89c

Browse files
committed
Rust: Rename isConstant -> hasConstant.
1 parent d15895c commit fcdb89c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ module HardcodedCryptographicValue {
6262
abstract class Barrier extends DataFlow::Node { }
6363

6464
/**
65-
* Holds if `e` is a literal or a combination of literals that is constant.
65+
* Holds if `e` is a literal or a combination of literals that may be a constant.
6666
*/
67-
private predicate isConstant(Expr e) {
67+
private predicate hasConstant(Expr e) {
6868
e instanceof LiteralExpr // e.g. `0`
6969
or
70-
forex(Expr elem | elem = e.(ArrayListExpr).getExpr(_) | isConstant(elem)) // e.g. `[0, 0, 0, 0]`
70+
forex(Expr elem | elem = e.(ArrayListExpr).getExpr(_) | hasConstant(elem)) // e.g. `[0, 0, 0, 0]`
7171
or
72-
isConstant(e.(ArrayRepeatExpr).getRepeatOperand()) // e.g. `[0; 10]`
72+
hasConstant(e.(ArrayRepeatExpr).getRepeatOperand()) // e.g. `[0; 10]`
7373
or
7474
// a match expression with one or more constant arms; taint would reach here
7575
// anyway, but we make it a source to avoid reporting many similar results
7676
// on each match arm.
77-
isConstant(e.(MatchExpr).getMatchArmList().getAnArm().getExpr())
77+
hasConstant(e.(MatchExpr).getMatchArmList().getAnArm().getExpr())
7878
or
7979
// e.g. `const MY_CONST: u64 = ...`
8080
// the constant initializer / body is the preferred source location for flow paths, when available.
@@ -86,15 +86,15 @@ module HardcodedCryptographicValue {
8686
not exists(e.(ConstAccess).getConst().getBody())
8787
or
8888
// e.g. `1 << 4`
89-
isConstant(e.(BinaryExpr).getLhs()) and
90-
isConstant(e.(BinaryExpr).getRhs())
89+
hasConstant(e.(BinaryExpr).getLhs()) and
90+
hasConstant(e.(BinaryExpr).getRhs())
9191
}
9292

9393
/**
9494
* A constant, considered as a flow source.
9595
*/
9696
private class ConstantSource extends Source {
97-
ConstantSource() { isConstant(this.asExpr()) }
97+
ConstantSource() { hasConstant(this.asExpr()) }
9898
}
9999

100100
/**

0 commit comments

Comments
 (0)