Skip to content

Commit a5007bd

Browse files
committed
CPP: Improve the logic in ArithmeticWithExtremeValues.ql.
1 parent 91893ae commit a5007bd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cpp/ql/src/Security/CWE/CWE-190/ArithmeticWithExtremeValues.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ predicate isMinValue(MacroInvocationExpr mie) {
3535

3636
class SecurityOptionsArith extends SecurityOptions {
3737
override predicate isUserInput(Expr expr, string cause) {
38-
(isMaxValue(expr) and cause = "max value") or
39-
(isMinValue(expr) and cause = "min value")
38+
(isMaxValue(expr) and cause = "overflow") or
39+
(isMinValue(expr) and cause = "underflow")
4040
}
4141
}
4242

43-
predicate taintedVarAccess(Expr origin, VariableAccess va) {
44-
isUserInput(origin, _) and
43+
predicate taintedVarAccess(Expr origin, VariableAccess va, string cause) {
44+
isUserInput(origin, cause) and
4545
tainted(origin, va)
4646
}
4747

4848
from Expr origin, Operation op, VariableAccess va, string effect
49-
where taintedVarAccess(origin, va)
49+
where taintedVarAccess(origin, va, effect)
5050
and op.getAnOperand() = va
5151
and
5252
(

0 commit comments

Comments
 (0)