@@ -63,7 +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 IncrementOperation and not guardedLesser ( e , varUse ( v ) ) ) or
66
+ ( e instanceof IncrementOperation and not guardedLesser ( e , varUse ( v ) ) and v . getType ( ) . getUnspecifiedType ( ) instanceof IntegralType ) or
67
67
// overflow possible if large or small
68
68
( e instanceof MulExpr and
69
69
not ( guardedLesser ( e , varUse ( v ) ) and guardedGreater ( e , varUse ( v ) ) ) )
@@ -77,7 +77,7 @@ predicate missingGuardAgainstUnderflow(Operation e, VariableAccess use) {
77
77
// underflow possible if use is left operand and small
78
78
( use = e .( SubExpr ) .getLeftOperand ( ) and not guardedGreater ( e , varUse ( v ) ) ) or
79
79
// underflow possible if small
80
- ( e instanceof DecrementOperation and not guardedGreater ( e , varUse ( v ) ) ) or
80
+ ( e instanceof DecrementOperation and not guardedGreater ( e , varUse ( v ) ) and v . getType ( ) . getUnspecifiedType ( ) instanceof IntegralType ) or
81
81
// underflow possible if large or small
82
82
( e instanceof MulExpr and
83
83
not ( guardedLesser ( e , varUse ( v ) ) and guardedGreater ( e , varUse ( v ) ) ) )
0 commit comments