Skip to content

Commit cf689b8

Browse files
ihsinmeMathiasVP
andauthored
Apply suggestions from code review
Co-authored-by: Mathias Vorreiter Pedersen <[email protected]>
1 parent b118817 commit cf689b8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-783/OperatorPrecedenceLogicErrorWhenUseBitwiseOrLogicalOperations.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import cpp
1616
import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
1717

1818
/** Holds if `exptmp` equals expression logical or followed by logical and. */
19-
predicate isLogicalOrAndExpr(Expr exptmp) {
20-
not exptmp.(LogicalOrExpr).getLeftOperand() instanceof BinaryOperation and
21-
not exptmp.(LogicalOrExpr).getRightOperand().isParenthesised() and
22-
exptmp.(LogicalOrExpr).getRightOperand() instanceof LogicalAndExpr
19+
predicate isLogicalOrAndExpr(LogicalOrExpr exptmp) {
20+
not exptmp.getLeftOperand() instanceof BinaryOperation and
21+
not exptmp.getRightOperand().isParenthesised() and
22+
exptmp.getRightOperand() instanceof LogicalAndExpr
2323
}
2424

2525
/** Holds if `exptmp` equals expression logical or followed by bit operation. */
@@ -158,10 +158,10 @@ predicate isDifferentResults(
158158
from Expr exp, string msg
159159
where
160160
isLogicalOrAndExpr(exp) and
161-
msg = "Logical and has a higher priority."
161+
msg = "Logical AND has a higher priority."
162162
or
163163
isLogicalOrandBitwise(exp) and
164-
msg = "Binary operations has higher priority."
164+
msg = "Binary operations have higher priority."
165165
or
166166
isBitwiseandBitwise(exp) and
167167
isDifferentSize(exp.(BinaryBitwiseOperation).getLeftOperand(),

0 commit comments

Comments
 (0)