Skip to content

Commit 3c96b09

Browse files
committed
C++: Behaviour preserving transform.
1 parent dcf2f7f commit 3c96b09

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpp/ql/src/Likely Bugs/Arithmetic/UnsignedGEZero.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class ConstantZero extends Expr {
2121
*/
2222
private predicate lookForUnsignedAt(GEExpr ge, Expr candidate) {
2323
// Base case: `candidate >= 0`
24-
ge.getRightOperand() instanceof ConstantZero and
25-
candidate = ge.getLeftOperand().getFullyConverted() and
26-
// left operand was a signed or unsigned IntegralType before conversions
24+
ge.getLesserOperand() instanceof ConstantZero and
25+
candidate = ge.getGreaterOperand().getFullyConverted() and
26+
// left/greater operand was a signed or unsigned IntegralType before conversions
2727
// (not a pointer, checking a pointer >= 0 is an entirely different mistake)
2828
// (not an enum, as the fully converted type of an enum is compiler dependent
2929
// so checking an enum >= 0 is always reasonable)
30-
ge.getLeftOperand().getUnderlyingType() instanceof IntegralType
30+
ge.getGreaterOperand().getUnderlyingType() instanceof IntegralType
3131
or
3232
// Recursive case: `...(largerType)candidate >= 0`
3333
exists(Conversion conversion |

0 commit comments

Comments
 (0)