Update DivideByZeroUsingReturnValue.ql

This commit is contained in:
ihsinme
2022-10-11 13:11:45 +03:00
committed by GitHub
parent 01b357e749
commit 3954da5938

View File

@@ -97,15 +97,6 @@ predicate compareFunctionWithValue(Expr guardExp, Function compArg, Expr valArg)
or
gc.ensuresLt(valArg, globalValueNumber(compArg.getACallToThisFunction()).getAnExpr(), 0,
guardExp.getBasicBlock(), false)
or
if valArg.getValue().toFloat() = 0
then
exists(NotExpr ne, IfStmt ifne |
ne.getOperand() = globalValueNumber(compArg.getACallToThisFunction()).getAnExpr() and
ifne.getCondition() = ne and
ifne.getThen().getAChild*() = guardExp
)
else none()
)
or
exists(Expr exp |
@@ -118,6 +109,13 @@ predicate compareFunctionWithValue(Expr guardExp, Function compArg, Expr valArg)
guardExp.getBasicBlock(), true)
)
)
or
valArg.getValue().toFloat() = 0 and
exists(NotExpr ne, IfStmt ifne |
ne.getOperand() = globalValueNumber(compArg.getACallToThisFunction()).getAnExpr() and
ifne.getCondition() = ne and
ifne.getThen().getAChild*() = guardExp
)
}
/** Wraping predicate for call `compareFunctionWithValue`. */
@@ -148,15 +146,6 @@ predicate compareExprWithValue(Expr guardExp, Expr compArg, Expr valArg) {
or
gc.ensuresLt(valArg, globalValueNumber(compArg).getAnExpr(), 0, guardExp.getBasicBlock(),
false)
or
if valArg.getValue().toFloat() = 0
then
exists(NotExpr ne, IfStmt ifne |
ne.getOperand() = globalValueNumber(compArg).getAnExpr() and
ifne.getCondition() = ne and
ifne.getThen().getAChild*() = guardExp
)
else none()
)
or
exists(Expr exp |
@@ -167,6 +156,13 @@ predicate compareExprWithValue(Expr guardExp, Expr compArg, Expr valArg) {
gc.ensuresLt(exp, globalValueNumber(compArg).getAnExpr(), 0, guardExp.getBasicBlock(), true)
)
)
or
valArg.getValue().toFloat() = 0 and
exists(NotExpr ne, IfStmt ifne |
ne.getOperand() = globalValueNumber(compArg).getAnExpr() and
ifne.getCondition() = ne and
ifne.getThen().getAChild*() = guardExp
)
}
/** Wraping predicate for call `compareExprWithValue`. */