Skip to content

Commit 8beacb8

Browse files
committed
Change predicate name from getX to getOrder
1 parent b451ada commit 8beacb8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

go/ql/lib/semmle/go/security/IncorrectIntegerConversionLib.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import go
33
/** The constant `math.MaxInt` or the constant `math.MaxUint`. */
44
abstract private class MaxIntOrMaxUint extends DeclaredConstant {
55
/**
6-
* Gets the integer `x` such that `2.pow(x) - 1` is the value of this
7-
* constant when the architecture has bit size `architectureBitSize`.
6+
* Gets the (binary) order of magnitude when the architecture has bit size
7+
* `architectureBitSize`, which is defined to be the integer `x` such that
8+
* `2.pow(x) - 1` is the value of this constant.
89
*/
9-
abstract int getX(int architectureBitSize);
10+
abstract int getOrder(int architectureBitSize);
1011

1112
/**
1213
* Holds if the value of this constant given `architectureBitSize` minus
@@ -15,7 +16,7 @@ abstract private class MaxIntOrMaxUint extends DeclaredConstant {
1516
predicate isBoundFor(int b, int architectureBitSize, float strictnessOffset) {
1617
// 2.pow(x) - 1 - strictnessOffset <= 2.pow(b) - 1
1718
exists(int x |
18-
x = this.getX(architectureBitSize) and
19+
x = this.getOrder(architectureBitSize) and
1920
b = validBitSize() and
2021
(
2122
strictnessOffset = 0 and x <= b
@@ -30,7 +31,7 @@ abstract private class MaxIntOrMaxUint extends DeclaredConstant {
3031
private class MaxInt extends MaxIntOrMaxUint {
3132
MaxInt() { this.hasQualifiedName("math", "MaxInt") }
3233

33-
override int getX(int architectureBitSize) {
34+
override int getOrder(int architectureBitSize) {
3435
architectureBitSize = [32, 64] and result = architectureBitSize - 1
3536
}
3637
}
@@ -39,7 +40,7 @@ private class MaxInt extends MaxIntOrMaxUint {
3940
private class MaxUint extends MaxIntOrMaxUint {
4041
MaxUint() { this.hasQualifiedName("math", "MaxUint") }
4142

42-
override int getX(int architectureBitSize) {
43+
override int getOrder(int architectureBitSize) {
4344
architectureBitSize = [32, 64] and result = architectureBitSize
4445
}
4546
}

0 commit comments

Comments
 (0)