File tree 1 file changed +2
-0
lines changed
cpp/ql/src/semmle/code/cpp/security
1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ predicate missingGuardAgainstOverflow(Operation e, VariableAccess use) {
63
63
exists ( LocalScopeVariable v | use .getTarget ( ) = v |
64
64
// overflow possible if large
65
65
( e instanceof AddExpr and not guardedLesser ( e , varUse ( v ) ) ) or
66
+ ( e instanceof AssignAddExpr and not guardedLesser ( e , varUse ( v ) ) ) or
66
67
( e instanceof IncrementOperation and not guardedLesser ( e , varUse ( v ) ) and v .getType ( ) .getUnspecifiedType ( ) instanceof IntegralType ) or
67
68
// overflow possible if large or small
68
69
( e instanceof MulExpr and
@@ -76,6 +77,7 @@ predicate missingGuardAgainstUnderflow(Operation e, VariableAccess use) {
76
77
exists ( LocalScopeVariable v | use .getTarget ( ) = v |
77
78
// underflow possible if use is left operand and small
78
79
( use = e .( SubExpr ) .getLeftOperand ( ) and not guardedGreater ( e , varUse ( v ) ) ) or
80
+ ( use = e .( AssignSubExpr ) .getLValue ( ) and not guardedGreater ( e , varUse ( v ) ) ) or
79
81
// underflow possible if small
80
82
( e instanceof DecrementOperation and not guardedGreater ( e , varUse ( v ) ) and v .getType ( ) .getUnspecifiedType ( ) instanceof IntegralType ) or
81
83
// underflow possible if large or small
You can’t perform that action at this time.
0 commit comments