File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
cpp/ql/src/Likely Bugs/Arithmetic Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,13 @@ import semmle.code.cpp.controlflow.SSA
2727 * In these cases the value of `e` is likely to be small and
2828 * controlled, so we consider it less likely to cause an overflow.
2929 */
30- predicate effectivelyConstant ( Expr e ) {
30+ predicate likelySmall ( Expr e ) {
3131 e .isConstant ( ) or
3232 e .getType ( ) .getSize ( ) <= 1 or
3333 e .( ArrayExpr ) .getArrayBase ( ) .getType ( ) .( ArrayType ) .getBaseType ( ) .isConst ( ) or
3434 exists ( SsaDefinition def , Variable v |
3535 def .getAUse ( v ) = e and
36- effectivelyConstant ( def .getDefiningValue ( v ) )
36+ likelySmall ( def .getDefiningValue ( v ) )
3737 )
3838}
3939
@@ -58,7 +58,7 @@ int getEffectiveMulOperands(MulExpr me) {
5858 result = count ( Expr op |
5959 op = getMulOperand * ( me ) and
6060 not op instanceof MulExpr and
61- not effectivelyConstant ( op )
61+ not likelySmall ( op )
6262 )
6363}
6464
You can’t perform that action at this time.
0 commit comments