Do not flow taint through remainder expressions

If the tainted operand is the first operand then it is being bounded above
by the remainder expression. If it is the second operand then
This commit is contained in:
Owen Mansel-Chan
2020-08-21 15:35:00 +01:00
parent aed3ef4cde
commit a669fa4aa1

View File

@@ -175,7 +175,7 @@ module AllocationSizeOverflow {
/**
* Holds if the value of `pred` can flow into `succ` in one step, either through a call to `len`
* or through an arithmetic operation.
* or through an arithmetic operation (other than remainder).
*/
predicate additionalStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(DataFlow::CallNode c |
@@ -184,7 +184,8 @@ module AllocationSizeOverflow {
succ = c
)
or
succ.asExpr().(ArithmeticExpr).getAnOperand() = pred.asExpr()
succ.asExpr().(ArithmeticExpr).getAnOperand() = pred.asExpr() and
not succ.asExpr() instanceof RemExpr
}
/**